Skip to content

Commit 09a242a

Browse files
[HttpClient] fix getting response content after its destructor throwed an HttpExceptionInterface
1 parent 0b6d9b6 commit 09a242a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Test/HttpClientTestCase.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,20 @@ public function testDestruct()
782782
$this->assertLessThan(4, $duration);
783783
}
784784

785+
public function testGetContentAfterDestruct()
786+
{
787+
$client = $this->getHttpClient(__FUNCTION__);
788+
789+
$start = microtime(true);
790+
791+
try {
792+
$client->request('GET', 'http://localhost:8057/404');
793+
$this->fail(ClientExceptionInterface::class.' expected');
794+
} catch (ClientExceptionInterface $e) {
795+
$this->assertSame('GET', $e->getResponse()->toArray(false)['REQUEST_METHOD']);
796+
}
797+
}
798+
785799
public function testProxy()
786800
{
787801
$client = $this->getHttpClient(__FUNCTION__);

0 commit comments

Comments
 (0)