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

[BrowserKit] Raw body with custom Content-Type header#36839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.4fromazhurb:raw_body_in_request
May 22, 2020

Conversation

@azhurb
Copy link
Contributor

@azhurbazhurb commentedMay 16, 2020
edited
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
LicenseMIT

Currently, if you try to send POST/PUT request with customContent-Type header and specified body, the real request will containtext/plain content type.

Following code

$client->request('POST','/url',    [],    [],    ['CONTENT_TYPE' =>'application/json'    ],'{"foo":"bar"}');

produces next request

POST /Content-Type: text/plain; charset=utf-8{"foo":"bar"}

With this fix, the request will be

POST /Content-Type: application/json{"foo":"bar"}

@ro0NL
Copy link
Contributor

Hi@azhurb, looks like it fixes#36640 :) cool.

WDYT of my patch suggestion in the issue? I believe there are some other cases where we need to preserve the given content-type as well.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks. Here is some nitpicking.

@azhurb
Copy link
ContributorAuthor

Hi@azhurb, looks like it fixes#36640 :) cool.

WDYT of my patch suggestion in the issue? I believe there are some other cases where we need to preserve the given content-type as well.

Hi@ro0NL. Actually I believe we need to preserve content-type only if the raw body data is not empty. It looks like other cases are already covered. Anyway, your patch should work as well :)

@azhurb
Copy link
ContributorAuthor

There is also discussion from 2016 about this issue#20042

@nicolas-grekasnicolas-grekas added this to the4.4 milestoneMay 18, 2020
@fabpotfabpotforce-pushed theraw_body_in_request branch fromc789964 tod2dd92bCompareMay 22, 2020 17:28
@fabpot
Copy link
Member

Thank you@azhurb.

@fabpotfabpot merged commit6d7c696 intosymfony:4.4May 22, 2020
This was referencedMay 26, 2020
kbond added a commit to zenstruck/browser that referenced this pull requestDec 2, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

5 participants

@azhurb@ro0NL@fabpot@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp