Skip to content

Commit 809a5f4

Browse files
[HttpClient] fix throwing HTTP exceptions when the 1st chunk is emitted
1 parent ffaf769 commit 809a5f4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Test/HttpClientTestCase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,16 @@ public function testClientError()
152152
$this->assertSame(404, $response->getStatusCode());
153153
$this->assertSame(['application/json'], $response->getHeaders(false)['content-type']);
154154
$this->assertNotEmpty($response->getContent(false));
155+
156+
$response = $client->request('GET', 'http://localhost:8057/404');
157+
158+
try {
159+
foreach ($client->stream($response) as $chunk) {
160+
$this->assertTrue($chunk->isFirst());
161+
}
162+
$this->fail(ClientExceptionInterface::class.' expected');
163+
} catch (ClientExceptionInterface $e) {
164+
}
155165
}
156166

157167
public function testIgnoreErrors()

0 commit comments

Comments
 (0)