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 a054362

Browse filesBrowse files
committed
[BrowserKit] Allowing body content from GET with a content-type
1 parent e185a6e commit a054362
Copy full SHA for a054362

File tree

2 files changed

+5
-1
lines changed
Filter options

2 files changed

+5
-1
lines changed

‎src/Symfony/Component/BrowserKit/HttpBrowser.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/BrowserKit/HttpBrowser.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function doRequest($request): Response
6161
*/
6262
private function getBodyAndExtraHeaders(Request $request, array $headers): array
6363
{
64-
if (('GET' === $request->getMethod() && !isset($headers['content-type'])) || 'HEAD' === $request->getMethod()) {
64+
if (\in_array($request->getMethod(), ['GET', 'HEAD']) && !isset($headers['content-type'])) {
6565
return ['', []];
6666
}
6767

‎src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/BrowserKit/Tests/HttpBrowserTest.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public function validContentTypes()
6767
['GET', 'http://example.com/jsonrpc', [], [], ['CONTENT_TYPE' => 'application/json'], '["content"]'],
6868
['GET', 'http://example.com/jsonrpc', ['headers' => $defaultHeaders + ['content-type' => 'application/json'], 'body' => '["content"]', 'max_redirects' => 0]],
6969
];
70+
yield 'HEAD JSON' => [
71+
['HEAD', 'http://example.com/jsonrpc', [], [], ['CONTENT_TYPE' => 'application/json'], '["content"]'],
72+
['HEAD', 'http://example.com/jsonrpc', ['headers' => $defaultHeaders + ['content-type' => 'application/json'], 'body' => '["content"]', 'max_redirects' => 0]],
73+
];
7074
}
7175

7276
public function testMultiPartRequestWithSingleFile()

0 commit comments

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