Skip to content

Relax content-type matching #149

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

Closed

Conversation

CaptainCodeman
Copy link
Contributor

This relaxes the Content-Type header matching in the context.Bind method.

Angular 1.x sets the header to application/json;charset=utf-8 (note the lack of any space after the ;) so checking that the string application/json; charset=utf-8 starts with that header fails which prevents Angular $resource or $http etc... being used without extra client work.

I think the match should be the other way round - check if the header starts with simpler application/json string instead and ignore anything else.

I added the applicationJSON const because ApplicationJSON is used for other things as well. It's not a very good name and should probably be called ApplicationJSONPrefix or something similar but probably shouldn't be exported. I'm sure there is some official Content-Type parsing / matching rule somewhere though so we should probably follow that.

@vishr
Copy link
Member

vishr commented Jul 21, 2015

@CaptainCodeman: Let me think over it.

@vishr vishr closed this in 17c83a0 Jul 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants