8000 [HttpClient] Fixing sending content type based on `CURLOPT_INFILESIZE` · symfony/symfony@c67a689 · GitHub
[go: up one dir, main page]

Skip to content

Commit c67a689

Browse files
[HttpClient] Fixing sending content type based on CURLOPT_INFILESIZE
1 parent 32b631c commit c67a689

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,9 @@ public function request(string $method, string $url, array $options = []): Respo
252252

253253
if ('POST' !== $method) {
254254
$curlopts[\CURLOPT_UPLOAD] = true;
255+
$inFileSize = $curlopts[\CURLOPT_INFILESIZE] ?? -1;
255256

256-
if (!isset($options['normalized_headers']['content-type']) && 0 !== ($curlopts[\CURLOPT_INFILESIZE] ?? null)) {
257+
if (!isset($options['normalized_headers']['content-type']) && 0 > $inFileSize) {
257258
$curlopts[\CURLOPT_HTTPHEADER][] = 'Content-Type: application/x-www-form-urlencoded';
258259
}
259260
}

0 commit comments

Comments
 (0)
0