8000 Merge branch '4.4' into 5.4 · symfony/symfony@2de0ebe · GitHub
[go: up one dir, main page]

Skip to content

Commit 2de0ebe

Browse files
Merge branch '4.4' into 5.4
* 4.4: Revert "bug #45813 [HttpClient] Move Content-Type after Content-Length (nicolas-grekas)"
2 parents 21cd0af + 67dd69b commit 2de0ebe

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

src/Symfony/Component/HttpClient/HttpClientTrait.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,6 @@ private static function prepareRequest(?string $method, ?string $url, array $opt
171171
}
172172

173173
$options['max_duration'] = isset($options['max_duration']) ? (float) $options['max_duration'] : 0;
174-
175-
if (isset($options['normalized_headers']['content-length']) && $contentType = $options['normalized_headers']['content-type'] ?? null) {
176-
// Move Content-Type after Content-Length, see https://bugs.php.net/44603
177-
unset($options['normalized_headers']['content-type']);
178-
$options['normalized_headers']['content-type'] = $contentType;
179-
}
180-
181174
$options['headers'] = array_merge(...array_values($options['normalized_headers']));
182175

183176
return [$url, $options];

src/Symfony/Component/HttpClient/Tests/ScopingHttpClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function testMatchingUrlsAndOptions()
7373

7474
$response = $client->request('GET', 'http://example.com/foo-bar', ['json' => ['url' => 'http://example.com']]);
7575
$requestOptions = $response->getRequestOptions();
76-
$this->assertSame('Content-Type: application/json', $requestOptions['headers'][3]);
76+
$this->assertSame('Content-Type: application/json', $requestOptions['headers'][1]);
7777
$requestJson = json_decode($requestOptions['body'], true);
7878
$this->assertSame('http://example.com', $requestJson['url']);
7979
$this->assertSame('X-FooBar: '.$defaultOptions['.*/foo-bar']['headers']['X-FooBar'], $requestOptions['headers'][0]);

0 commit comments

Comments
 (0)
0