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 67dd69b

Browse filesBrowse files
Revert "bug #45813 [HttpClient] Move Content-Type after Content-Length (nicolas-grekas)"
This reverts commit 13e0671, reversing changes made to 01f6749.
1 parent 6ea4613 commit 67dd69b
Copy full SHA for 67dd69b

File tree

2 files changed

+1
-8
lines changed
Filter options

2 files changed

+1
-8
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/HttpClientTrait.php
-7Lines 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];

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/Tests/ScopingHttpClientTest.php
+1-1Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.