[HttpClient] Minor fixes

This commit is contained in:
Thomas Calvet 2019-08-05 14:30:21 +02:00
parent c7aad8d800
commit 356341bc19
3 changed files with 4 additions and 5 deletions

View File

@ -1481,7 +1481,7 @@ class Configuration implements ConfigurationInterface
->info('A comma separated list of hosts that do not require a proxy to be reached.') ->info('A comma separated list of hosts that do not require a proxy to be reached.')
->end() ->end()
->floatNode('timeout') ->floatNode('timeout')
->info('Defaults to "default_socket_timeout" ini parameter.') ->info('The idle timeout, defaults to the "default_socket_timeout" ini parameter.')
->end() ->end()
->scalarNode('bindto') ->scalarNode('bindto')
->info('A network interface name, IP address, a host name or a UNIX socket to bind to.') ->info('A network interface name, IP address, a host name or a UNIX socket to bind to.')

View File

@ -37,7 +37,7 @@ class MockResponse implements ResponseInterface
/** /**
* @param string|string[]|iterable $body The response body as a string or an iterable of strings, * @param string|string[]|iterable $body The response body as a string or an iterable of strings,
* yielding an empty string simulates a timeout, * yielding an empty string simulates an idle timeout,
* exceptions are turned to TransportException * exceptions are turned to TransportException
* *
* @see ResponseInterface::getInfo() for possible info, e.g. "response_headers" * @see ResponseInterface::getInfo() for possible info, e.g. "response_headers"
@ -277,7 +277,7 @@ class MockResponse implements ResponseInterface
if (!\is_string($body)) { if (!\is_string($body)) {
foreach ($body as $chunk) { foreach ($body as $chunk) {
if ('' === $chunk = (string) $chunk) { if ('' === $chunk = (string) $chunk) {
// simulate a timeout // simulate an idle timeout
$response->body[] = new ErrorChunk($offset); $response->body[] = new ErrorChunk($offset);
} else { } else {
$response->body[] = $chunk; $response->body[] = $chunk;

View File

@ -580,7 +580,7 @@ abstract class HttpClientTestCase extends TestCase
$response = null; $response = null;
$this->expectException(TransportExceptionInterface::class); $this->expectException(TransportExceptionInterface::class);
$client->request('GET', 'http://symfony.com:8057/', ['timeout' => 3]); $client->request('GET', 'http://symfony.com:8057/', ['timeout' => 1]);
} }
public function testTimeoutOnAccess() public function testTimeoutOnAccess()
@ -643,7 +643,6 @@ abstract class HttpClientTestCase extends TestCase
{ {
$client = $this->getHttpClient(__FUNCTION__); $client = $this->getHttpClient(__FUNCTION__);
$downloaded = 0;
$start = microtime(true); $start = microtime(true);
$client->request('GET', 'http://localhost:8057/timeout-long'); $client->request('GET', 'http://localhost:8057/timeout-long');
$client = null; $client = null;