diff --git a/CHANGELOG.md b/CHANGELOG.md index d55d109..ba1e721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## Unreleased +- [**BC**] Add an `$initiator` to `ResponseDecoders` `supports` method +- Fix HttpProfilerFormatter test to work with cloned response ## 1.0.0 - 2021-05-13 - Initial implementation diff --git a/composer.json b/composer.json index ee696d5..8c21018 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "ext-json": "*", "ext-mbstring": "*", "fig/http-message-util": "^1.1", - "lmc/cqrs-types": "^1.0", + "lmc/cqrs-types": "^2.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0" diff --git a/src/Decoder/HttpMessageResponseDecoder.php b/src/Decoder/HttpMessageResponseDecoder.php index cbaba5b..8e472c8 100644 --- a/src/Decoder/HttpMessageResponseDecoder.php +++ b/src/Decoder/HttpMessageResponseDecoder.php @@ -11,7 +11,7 @@ */ class HttpMessageResponseDecoder implements ResponseDecoderInterface { - public function supports($response): bool + public function supports($response, $initiator): bool { return $response instanceof MessageInterface; } diff --git a/src/Decoder/StreamResponseDecoder.php b/src/Decoder/StreamResponseDecoder.php index 8e746aa..b1081e0 100644 --- a/src/Decoder/StreamResponseDecoder.php +++ b/src/Decoder/StreamResponseDecoder.php @@ -10,7 +10,7 @@ */ class StreamResponseDecoder implements ResponseDecoderInterface { - public function supports($response): bool + public function supports($response, $initiator): bool { return $response instanceof StreamInterface; } diff --git a/tests/Decoder/HttpMessageResponseDecoderTest.php b/tests/Decoder/HttpMessageResponseDecoderTest.php index da380a8..2b6f782 100644 --- a/tests/Decoder/HttpMessageResponseDecoderTest.php +++ b/tests/Decoder/HttpMessageResponseDecoderTest.php @@ -26,7 +26,7 @@ public function shouldDecodeNyholmMessage($message, bool $isSupported, $expected { $decoded = $this->decoder->decode($message); - $this->assertSame($isSupported, $this->decoder->supports($message)); + $this->assertSame($isSupported, $this->decoder->supports($message, null)); $this->assertEquals($expected, $decoded); } diff --git a/tests/Decoder/StreamResponseDecoderTest.php b/tests/Decoder/StreamResponseDecoderTest.php index d42cf39..0da55f2 100644 --- a/tests/Decoder/StreamResponseDecoderTest.php +++ b/tests/Decoder/StreamResponseDecoderTest.php @@ -26,7 +26,7 @@ public function shouldDecodeNyholmMessage($message, bool $isSupported, $expected { $decoded = $this->decoder->decode($message); - $this->assertSame($isSupported, $this->decoder->supports($message)); + $this->assertSame($isSupported, $this->decoder->supports($message, null)); $this->assertEquals($expected, $decoded); } diff --git a/tests/Formatter/HttpProfilerFormatterTest.php b/tests/Formatter/HttpProfilerFormatterTest.php index e451ffa..dcdce00 100644 --- a/tests/Formatter/HttpProfilerFormatterTest.php +++ b/tests/Formatter/HttpProfilerFormatterTest.php @@ -69,6 +69,7 @@ public function provideNyholmItems(): iterable 'test', '', $request = (new \Nyholm\Psr7\Request('get', 'url')) + ->withBody(\Nyholm\Psr7\Stream::create()) ), new ProfilerItem( 'id', @@ -251,6 +252,7 @@ public function provideGuzzleItems(): iterable 'test', '', $request = (new \GuzzleHttp\Psr7\Request('post', 'url')) + ->withBody(Utils::streamFor(null)) ), new ProfilerItem( 'id',