Skip to content

Commit 12f5708

Browse files
Revert "bug #45813 [HttpClient] Move Content-Type after Content-Length (nicolas-grekas)"
This reverts commit 13e0671ff9222d6797c5a44593c1a09f65e8a738, reversing changes made to 01f674975a2dd27340aab9b6e7402bc0aee8423f.
1 parent 62e681f commit 12f5708

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

HttpClientTrait.php

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

161161
$options['max_duration'] = isset($options['max_duration']) ? (float) $options['max_duration'] : 0;
162-
163-
if (isset($options['normalized_headers']['content-length']) && $contentType = $options['normalized_headers']['content-type'] ?? null) {
164-
// Move Content-Type after Content-Length, see https://bugs.php.net/44603
165-
unset($options['normalized_headers']['content-type']);
166-
$options['normalized_headers']['content-type'] = $contentType;
167-
}
168-
169162
$options['headers'] = array_merge(...array_values($options['normalized_headers']));
170163

171164
return [$url, $options];

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)