Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4947e02

Browse filesBrowse files
[HttpClient] Fixing sending content type based on CURLOPT_INFILESIZE
1 parent 32b631c commit 4947e02
Copy full SHA for 4947e02

File tree

1 file changed

+2
-1
lines changed
Filter options

1 file changed

+2
-1
lines changed

‎src/Symfony/Component/HttpClient/CurlHttpClient.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/CurlHttpClient.php
+2-1Lines 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] ?? null;
255256

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.