Permalink
Browse files

Merge pull request #2064 from AlessandroMinoccheri/split_in_many_lines

split some long lines in many
  • Loading branch information...
sagikazarmark committed Apr 23, 2018
2 parents da6a720 + 2e7aec0 commit 0773d442aa96baf19d7195f14ba6e9c2da11f8ed
Showing with 26 additions and 5 deletions.
  1. +14 −2 src/Handler/StreamHandler.php
  2. +8 −2 tests/Cookie/CookieJarTest.php
  3. +4 −1 tests/Handler/CurlFactoryTest.php
@@ -343,13 +343,25 @@ private function resolveHost(RequestInterface $request, array $options)
if ('v4' === $options['force_ip_resolve']) {
$records = dns_get_record($uri->getHost(), DNS_A);
if (!isset($records[0]['ip'])) {
- throw new ConnectException(sprintf("Could not resolve IPv4 address for host '%s'", $uri->getHost()), $request);
+ throw new ConnectException(
+ sprintf(
+ "Could not resolve IPv4 address for host '%s'",
+ $uri->getHost()
+ ),
+ $request
+ );
}
$uri = $uri->withHost($records[0]['ip']);
} elseif ('v6' === $options['force_ip_resolve']) {
$records = dns_get_record($uri->getHost(), DNS_AAAA);
if (!isset($records[0]['ipv6'])) {
- throw new ConnectException(sprintf("Could not resolve IPv6 address for host '%s'", $uri->getHost()), $request);
+ throw new ConnectException(
+ sprintf(
+ "Could not resolve IPv6 address for host '%s'",
+ $uri->getHost()
+ ),
+ $request
+ );
}
$uri = $uri->withHost('[' . $records[0]['ipv6'] . ']');
}
@@ -394,8 +394,14 @@ public function getCookiePathsDataProvider()
public function testCookiePathWithEmptySetCookiePath($uriPath, $cookiePath)
{
$response = (new Response(200))
- ->withAddedHeader('Set-Cookie', "foo=bar; expires=Fri, 02-Mar-2019 02:17:40 GMT; domain=www.example.com; path=;")
- ->withAddedHeader('Set-Cookie', "bar=foo; expires=Fri, 02-Mar-2019 02:17:40 GMT; domain=www.example.com; path=foobar;")
+ ->withAddedHeader(
+ 'Set-Cookie',
+ "foo=bar; expires=Fri, 02-Mar-2019 02:17:40 GMT; domain=www.example.com; path=;"
+ )
+ ->withAddedHeader(
+ 'Set-Cookie',
+ "bar=foo; expires=Fri, 02-Mar-2019 02:17:40 GMT; domain=www.example.com; path=foobar;"
+ )
;
$request = (new Request('GET', $uriPath))->withHeader('Host', 'www.example.com');
$this->jar->extractCookies($request, $response);
@@ -340,7 +340,10 @@ public function testDecodesGzippedResponsesWithHeader()
$this->assertEquals('gzip', $sent->getHeaderLine('Accept-Encoding'));
$this->assertEquals('test', (string) $response->getBody());
$this->assertFalse($response->hasHeader('content-encoding'));
- $this->assertTrue(!$response->hasHeader('content-length') || $response->getHeaderLine('content-length') == $response->getBody()->getSize());
+ $this->assertTrue(
+ !$response->hasHeader('content-length') ||
+ $response->getHeaderLine('content-length') == $response->getBody()->getSize()
+ );
}
public function testDoesNotForceDecode()

0 comments on commit 0773d44

Please sign in to comment.