Skip to content

Commit 5f7004d

Browse files
committed
don not set http_version instead of setting it to null
1 parent 57fbec5 commit 5f7004d

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/Symfony/Component/HttpClient/HttplugClient.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,17 @@ private function sendPsr7Request(RequestInterface $request, bool $buffer = null)
246246
$body->seek(0);
247247
}
248248

249-
return $this->client->request($request->getMethod(), (string) $request->getUri(), [
249+
$options = [
250250
'headers' => $request->getHeaders(),
251251
'body' => $body->getContents(),
252-
'http_version' => '1.0' === $request->getProtocolVersion() ? '1.0' : null,
253252
'buffer' => $buffer,
254-
]);
253+
];
254+
255+
if ('1.0' === $request->getProtocolVersion()) {
256+
$options['http_version'] = '1.0';
257+
}
258+
259+
return $this->client->request($request->getMethod(), (string) $request->getUri(), $options);
255260
} catch (\InvalidArgumentException $e) {
256261
throw new RequestException($e->getMessage(), $request, $e);
257262
} catch (TransportExceptionInterface $e) {

src/Symfony/Component/HttpClient/Psr18Client.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,16 @@ public function sendRequest(RequestInterface $request): ResponseInterface
9090
$body->seek(0);
9191
}
9292

93-
$response = $this->client->request($request->getMethod(), (string) $request->getUri(), [
93+
$options = [
9494
'headers' => $request->getHeaders(),
9595
'body' => $body->getContents(),
96-
'http_version' => '1.0' === $request->getProtocolVersion() ? '1.0' : null,
97-
]);
96+
];
97+
98+
if ('1.0' === $request->getProtocolVersion()) {
99+
$options['http_version'] = '1.0';
100+
}
101+
102+
$response = $this->client->request($request->getMethod(), (string) $request->getUri(), $options);
98103

99104
$psrResponse = $this->responseFactory->createResponse($response->getStatusCode());
100105

0 commit comments

Comments
 (0)