Don't die if a charset param exists along w/ mediatype #30

Merged
merged 1 commit into from Sep 3, 2013

Conversation

Projects
None yet
2 participants
Contributor

yannk commented Sep 2, 2013

application/json; charset=UTF-8 would fail despite being what the library
implicitely expects. Update checks and documentation to make sure we accepts
requests accordingly and reject them otherwise (even for the spec default
of "; charset=ISO-8859-1"

Don't die if a charset param exists along w/ mediatype
`application/json; charset=UTF-8` would fail despite being what the library
implicitely expects. Update checks and documentation to make sure we accepts
requests accordingly and reject them otherwise (even for the spec default
of "; charset=ISO-8859-1"
Contributor

yannk commented Sep 2, 2013

Chrome (probably like many others) send 'application/json;charset=UTF-8" when doing a json POST request

ant0ine commented on 980f1e6 Sep 2, 2013

Thanks! I think it's nice to support Chrome, even with the strict flag on.

But, I think the super strict version of the content-type is "application/json" without the charset.
At least that's what I understand here: http://www.ietf.org/rfc/rfc4627.txt I may be wrong.

In that case, the error message should suggest "application/json"

Error(&writer, "Bad Content-Type, expected 'application/json'", http.StatusUnsupportedMediaType)

ant0ine added a commit that referenced this pull request Sep 3, 2013

Merge pull request #30 from yannk/master
Don't die if a charset param exists along w/ mediatype

@ant0ine ant0ine merged commit 69f3748 into ant0ine:master Sep 3, 2013

1 check passed

default The Travis CI build passed
Details
Contributor

yannk commented Sep 3, 2013

It's not clear... I think json RFC mandates it shouldn't be set, but if it is, it shouldn't blow up?
And my understanding of http://www.w3.org/TR/XMLHttpRequest/ is that charset should be added by user-agents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment