Skip to content

Commit 6db12f0

Browse files
[HttpClient] fix dealing with 1xx informational responses
1 parent c257cc4 commit 6db12f0

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Test/Fixtures/web/index.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141
ob_start('ob_gzhandler');
4242
break;
4343

44+
case '/103':
45+
header('HTTP/1.1 103 Early Hints');
46+
header('Link: </style.css>; rel=preload; as=style', false);
47+
header('Link: </script.js>; rel=preload; as=script', false);
48+
echo "HTTP/1.1 200 OK\r\n";
49+
echo "Date: Fri, 26 May 2017 10:02:11 GMT\r\n";
50+
echo "Content-Length: 13\r\n";
51+
echo "\r\n";
52+
echo 'Here the body';
53+
exit;
54+
4455
case '/404':
4556
header('Content-Type: application/json', true, 404);
4657
break;

Test/HttpClientTestCase.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,15 @@ public function testQuery()
721721
$this->assertSame('/?a=a&b=b', $body['REQUEST_URI']);
722722
}
723723

724+
public function testInformationalResponse()
725+
{
726+
$client = $this->getHttpClient(__FUNCTION__);
727+
$response = $client->request('GET', 'http://localhost:8057/103');
728+
729+
$this->assertSame('Here the body', $response->getContent());
730+
$this->assertSame(200, $response->getStatusCode());
731+
}
732+
724733
/**
725734
* @requires extension zlib
726735
*/

0 commit comments

Comments
 (0)