Skip to content

Commit 059961c

Browse files
committed
Fix response parsing and creation with last version of message factory
1 parent 800a069 commit 059961c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/ResponseReader.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,17 @@ protected function readResponse(RequestInterface $request, $socket)
6767

6868
foreach ($headers as $header) {
6969
$headerParts = explode(':', $header, 2);
70-
$responseHeaders[trim($headerParts[0])] = isset($headerParts[1])
70+
71+
if (!array_key_exists(trim($headerParts[0]), $responseHeaders)) {
72+
$responseHeaders[trim($headerParts[0])] = [];
73+
}
74+
75+
$responseHeaders[trim($headerParts[0])][] = isset($headerParts[1])
7176
? trim($headerParts[1])
7277
: '';
7378
}
7479

75-
$response = $this->messageFactory->createResponse($status, $reason, $protocol, $responseHeaders, null);
80+
$response = $this->messageFactory->createResponse($status, $reason, $responseHeaders, null, $protocol);
7681
$stream = $this->createStream($socket, $response);
7782

7883
return $response->withBody($stream);

tests/SocketHttpAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Http\Socket\Tests;
44

5-
use Http\Adapter\Tests\HttpAdapterTest;
5+
use Http\Client\Tests\HttpClientTest;
66
use Http\Discovery\MessageFactory\GuzzleFactory;
77
use Http\Socket\SocketHttpClient;
88

9-
class SocketHttpAdapterTest extends HttpAdapterTest
9+
class SocketHttpAdapterTest extends HttpClientTest
1010
{
1111
/**
1212
* {@inheritdoc}

0 commit comments

Comments
 (0)