Fix ajax json requests should be application/json

pull/6034/head
Berkeley Martinez 2016-01-09 19:59:17 -08:00
parent 5bd52b0423
commit 0316c31708
1 changed files with 12 additions and 2 deletions

View File

@ -272,7 +272,10 @@ export function postJSON$(url, body) {
body,
method: 'POST',
responseType: 'json',
headers: { 'Content-Type': 'application/json' }
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
}
@ -294,7 +297,14 @@ export function get$(url) {
* @returns {Observable} The observable sequence which contains the parsed JSON
*/
export function getJSON$(url) {
return ajax$({ url: url, responseType: 'json' }).map(function(x) {
return ajax$({
url: url,
responseType: 'json',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
}).map(function(x) {
return x.response;
});
}