Skip to content

[HttpFoundation] Removed "Content-Type" from the preferred format guessing mechanism #34921

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2019

Conversation

yceruto
Copy link
Member

@yceruto yceruto commented Dec 10, 2019

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #34906, Fix #34857
License MIT
Doc PR -

Confirmed, inferring the Content-Type of the response using the Content-Type provided for the request body is NOT a good idea. The HTTP RFC explicitly states that Accept must be used to hint a preferred response format (Content-Type on the request indicates the type of associated its the body).

Use Accept if provided (a best practice anyway), and fallback to the default value (HTML by default) otherwise.

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

Thank you for the PR :)

@fabpot
Copy link
Member

fabpot commented Dec 11, 2019

Thank you @yceruto.

fabpot added a commit that referenced this pull request Dec 11, 2019
… format guessing mechanism (yceruto)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpFoundation] Removed "Content-Type" from the preferred format guessing mechanism

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34906, Fix #34857
| License       | MIT
| Doc PR        | -

Confirmed, inferring the `Content-Type` of the response using the `Content-Type` provided for the request body is NOT a good idea. The HTTP RFC explicitly states that `Accept` must be used to hint a preferred response format (`Content-Type` on the request indicates the type of associated its the body).

Use `Accept` if provided (a best practice anyway), and fallback to the default value (HTML by default) otherwise.

Commits
-------

776523e Removed request header "Content-Type" from the preferred format guessing mechanism
@fabpot fabpot merged commit 776523e into symfony:4.4 Dec 11, 2019
@yceruto yceruto deleted the request_preferred_format branch December 11, 2019 01:35
This was referenced Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants