8000 Stream request body in HttplugClient and Psr18Client · symfony/symfony@d412f7b · GitHub
[go: up one dir, main page]

Skip to content

Commit d412f7b

Browse files
committed
Stream request body in HttplugClient and Psr18Client
1 parent dbacea3 commit d412f7b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Symfony/Component/HttpClient/HttplugClient.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ private function sendPsr7Request(RequestInterface $request, ?bool $buffer = null
231231

232232
$options = [
233233
'headers' => $request->getHeaders(),
234-
'body' => $body->getContents(),
234+
'body' => function (int $size) use ($body) {
235+
return $body->read($size);
236+
},
235237
'buffer' => $buffer,
236238
];
237239

src/Symfony/Component/HttpClient/Psr18Client.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ public function sendRequest(RequestInterface $request): ResponseInterface
9595

9696
$options = [
9797
'headers' => $request->getHeaders(),
98-
'body' => $body->getContents(),
98+
'body' => function (int $size) use ($body) {
99+
return $body->read($size);
100+
},
99101
];
100102

101103
if ('1.0' === $request->getProtocolVersion()) {

0 commit comments

Comments
 (0)
0