File tree 2 files changed +11
-2
lines changed
src/Symfony/Component/HttpClient
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -73,13 +73,13 @@ public function sendRequest(RequestInterface $request): ResponseInterface
73
73
74
74
$ psrResponse = $ this ->responseFactory ->createResponse ($ response ->getStatusCode ());
75
75
76
- foreach ($ response ->getHeaders () as $ name => $ values ) {
76
+ foreach ($ response ->getHeaders (false ) as $ name => $ values ) {
77
77
foreach ($ values as $ value ) {
78
78
$ psrResponse = $ psrResponse ->withAddedHeader ($ name , $ value );
79
79
}
80
80
}
81
81
82
- return $ psrResponse ->withBody ($ this ->streamFactory ->createStream ($ response -&
8000
gt;getContent ()));
82
+ return $ psrResponse ->withBody ($ this ->streamFactory ->createStream ($ response ->getContent (false )));
83
83
} catch (TransportExceptionInterface $ e ) {
84
84
if ($ e instanceof \InvalidArgumentException) {
85
85
throw new Psr18RequestException ($ e , $ request );
Original file line number Diff line number Diff line change @@ -74,4 +74,13 @@ public function testRequestException()
74
74
$ this ->expectException (Psr18RequestException::class);
75
75
$ client ->sendRequest ($ factory ->createRequest ('BAD.METHOD ' , 'http://localhost:8057 ' ));
76
76
}
77
+
78
+ public function test404 ()
79
+ {
80
+ $ factory = new Psr17Factory ();
81
+ $ client = new Psr18Client (new NativeHttpClient ());
82
+
83
+ $ response = $ client ->sendRequest ($ factory ->createRequest ('GET ' , 'http://localhost:8057/404 ' ));
84
+ $ this ->assertSame (404 , $ response ->getStatusCode ());
85
+ }
77
86
}
You can’t perform that action at this time.
0 commit comments