Skip to content

Commit 0cb2b66

Browse files
dmitryuka.dmitryuk
and
a.dmitryuk
authored
Guzzle psr7 v2 support (#187)
Co-authored-by: a.dmitryuk <[email protected]>
1 parent fea41ee commit 0cb2b66

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"php-pm/php-pm": "^2.0",
77
"symfony/http-foundation": "^4.2.12|^5.0|^6.0",
88
"symfony/http-kernel": "^4.0|^5.0|^6.0",
9-
"guzzlehttp/psr7": "^1.5"
9+
"guzzlehttp/psr7": "^1.5|^2.0"
1010
},
1111
"require-dev": {
1212
"phpunit/phpunit": "^9.5",

src/Bridges/HttpKernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ protected function mapResponse(SymfonyResponse $syResponse, $stdout='')
308308
if (!isset($headers['Content-Length'])) {
309309
$psrResponse = $psrResponse->withAddedHeader('Content-Length', strlen($content));
310310
}
311-
312-
$psrResponse = $psrResponse->withBody(Psr7\stream_for($content));
311+
$body = class_exists('\GuzzleHttp\Psr7\Utils') ? Psr7\Utils::streamFor($content) : Psr7\stream_for($content);
312+
$psrResponse = $psrResponse->withBody($body);
313313

314314
foreach ($this->tempFiles as $tmpname) {
315315
if (file_exists($tmpname)) {

0 commit comments

Comments
 (0)