fix issue 1919

This commit is contained in:
tkilliansc 2017-08-03 13:48:19 -07:00 committed by Pierre-Yves Gérardy
parent 4d7e4db29d
commit 62bc8a5481
4 changed files with 30 additions and 5 deletions

View file

@ -67,10 +67,10 @@ module.exports = function($window, Promise) {
xhr.open(args.method, args.url, typeof args.async === "boolean" ? args.async : true, typeof args.user === "string" ? args.user : undefined, typeof args.password === "string" ? args.password : undefined)
if (args.serialize === JSON.stringify && useBody) {
if (args.serialize === JSON.stringify && useBody && !(args.headers && args.headers.hasOwnProperty("Content-Type"))) {
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
}
if (args.deserialize === deserialize) {
if (args.deserialize === deserialize && !(args.headers && args.headers.hasOwnProperty("Accept"))) {
xhr.setRequestHeader("Accept", "application/json, text/*")
}
if (args.withCredentials) xhr.withCredentials = args.withCredentials