[m.request] work around a bundler bug, fix #2647
This commit is contained in:
parent
e66aaf1458
commit
44d407f24c
1 changed files with 3 additions and 3 deletions
|
|
@ -67,7 +67,7 @@ module.exports = function($window, Promise, oncompletion) {
|
|||
|
||||
function hasHeader(args, name) {
|
||||
for (var key in args.headers) {
|
||||
if (hasOwn.call(args.headers, key) && name.test(key)) return true
|
||||
if (hasOwn.call(args.headers, key) && key.toLowerCase() === name) return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
@ -90,10 +90,10 @@ module.exports = function($window, Promise, oncompletion) {
|
|||
|
||||
xhr.open(method, url, args.async !== false, typeof args.user === "string" ? args.user : undefined, typeof args.password === "string" ? args.password : undefined)
|
||||
|
||||
if (assumeJSON && body != null && !hasHeader(args, /^content-type$/i)) {
|
||||
if (assumeJSON && body != null && !hasHeader(args, "content-type")) {
|
||||
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
|
||||
}
|
||||
if (typeof args.deserialize !== "function" && !hasHeader(args, /^accept$/i)) {
|
||||
if (typeof args.deserialize !== "function" && !hasHeader(args, "accept")) {
|
||||
xhr.setRequestHeader("Accept", "application/json, text/*")
|
||||
}
|
||||
if (args.withCredentials) xhr.withCredentials = args.withCredentials
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue