Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit08a6428

Browse files
bug#59763 [HttpClient] Don't send any default content-type when the body is empty (nicolas-grekas)
This PR was merged into the 6.4 branch.Discussion----------[HttpClient] Don't send any default content-type when the body is empty| Q | A| ------------- | ---| Branch? | 6.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues | -| License | MITIssue was introduced in#49911Commits-------4a475e0 [HttpClient] Don't send any default content-type when the body is empty
2 parents5e433ee +4a475e0 commit08a6428

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,11 @@ private static function normalizeBody($body, array &$normalizedHeaders = [])
356356
}
357357
});
358358

359-
$body =http_build_query($body,'','&');
359+
if ('' ===$body =http_build_query($body,'','&')) {
360+
return'';
361+
}
360362

361-
if ('' ===$body ||!$streams && !str_contains($normalizedHeaders['content-type'][0] ??'','multipart/form-data')) {
363+
if (!$streams && !str_contains($normalizedHeaders['content-type'][0] ??'','multipart/form-data')) {
362364
if (!str_contains($normalizedHeaders['content-type'][0] ??'','application/x-www-form-urlencoded')) {
363365
$normalizedHeaders['content-type'] = ['Content-Type: application/x-www-form-urlencoded'];
364366
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp