Content-type and Encoding
See original GitHub issueHi there,
I’m trying to send a custom ajax call to my backend server, which is a JSONAPI.org server. I don’t know why, but when I try to send a Content-Type
header (application/vnd.api+json
) ember-ajax
is form encoding the request.
this.get('ajax').request('/api/v1/things', {
method: 'POST',
data: {
// ......
},
headers: {
'Content-Type': 'application/vnd.api+json',
'Accept': 'application/vnd.api+json'
}
}).then( jsonapiResponse => {
// .....
});
Checking my server logs is getting the body sent as a big form encoded blob, rather than JSON.
Am I doing something wrong?
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
What does "Content-type: application/json; charset=utf-8 ...
Content-type : application/json; charset=utf-8 designates the content to be in JSON format, encoded in the UTF-8 character encoding. Designating the encoding ...
Read more >Content-Type - HTTP - MDN Web Docs - Mozilla
The Content-Type representation header is used to indicate the original media type of the resource (prior to any content encoding applied ...
Read more >Setting the HTTP charset parameter - W3C
Hints on sending out character encoding information using the HTTP charset parameter. Includes pointers on how to set up your server or send ......
Read more >What's the basic difference between Content-Type ... - Quora
Content-type : is format of data sending or accepting from source to destination and vice versa. Content-Encoding : is the text sent through...
Read more >Content Encoding: why and how to use the meta charset tag ...
Content Encoding: why and how to use the meta charset tag and the Content-Type header ... Improving the speed at which a web...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@brandonparsons Content-Type should be specified as they’re in jQuery by providing
contentType
key to options hash.For all other headers, you can use
headers
hash as you have been.Hi @alexlafroscia - I did extend it, but only barely: