Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

No charset in Content-Type header when posting JSON #254

Closed
csainty opened this Issue · 2 comments

3 participants

@csainty

Currently, when you set a json body using the json property the following headers are added to your request.

  this.setHeader('content-type', 'application/json')
  this.setHeader('accept', 'application/json')

The content-type lacks a charset, which I believe the http rfc says should be treated as ISO-8859-1.

Thoughts on either adding a charset=utf-8 like on the form bodies or opening up some way to set the charset?
Happy to do a PR for you, just wanted to know your thoughts on the best approach.

@kevinoid
Collaborator

Quite the contrary, RFC 4627 does not define a charset parameter because it requires that JSON is always encoded in Unicode. Perhaps you are thinking of section 3.7.1 of RFC 2616 which defines ISO-8859-1 as the default for subtypes of the "text" type (of which application/json is not)?

@mikeal
Owner

this also came up in a new thread and i'm more worried about breaking dumb checks for application/json than I am in breaking the few out of spec implementations that require this.

@mikeal mikeal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.