Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Negotiate Response Content-Type from request's Accept header. #1403

Closed

Conversation

duckbrain
Copy link
Contributor

@duckbrain duckbrain commented Oct 23, 2018

Resolves #1148

This changes the default Context to negotiate the response Content-Type using the request's Accept header exclusively, instead of including the request's Content-Type in the negotiation. Failed negotiation will default to using render.Options#DefaultContentType. (This is important because Internet Explorer does not pass an Accept header that negotiates HTML.)

This is not backwards compatible

HTTP clients using Content-Type instead of Accept in their request headers will not work the same way. Code that overrides these values (such as those using https://github.com/gobuffalo/mw-contenttype) will no longer have the desired effect. They should be removed in favor of the DefaultContentType option or a middleware that sets the Accept header.

gobuffalo/httptest#2 is needed for tests to pass Merged!

@duckbrain duckbrain requested a review from a team as a code owner October 23, 2018 18:33
@duckbrain duckbrain changed the title WIP: Negotiate Response Content-Type from request's Accept header. Negotiate Response Content-Type from request's Accept header. Dec 14, 2018
@duckbrain
Copy link
Contributor Author

Does this need to add something for buffalo fix to fix https://github.com/gobuffalo/mw-contenttype middleware links to a new route that Add/Set's the Accept header?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants