don't send content-type header if no data
This commit is contained in:
parent
1032dc49d7
commit
75d7221d06
1 changed files with 2 additions and 2 deletions
|
|
@ -857,7 +857,7 @@ Mithril = m = new function app(window, undefined) {
|
|||
else options.onerror({type: "error", target: xhr})
|
||||
}
|
||||
}
|
||||
if (options.serialize == JSON.stringify && options.method != "GET") {
|
||||
if (options.serialize == JSON.stringify && options.data && options.method != "GET") {
|
||||
xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8")
|
||||
}
|
||||
if (typeof options.config == "function") {
|
||||
|
|
@ -865,7 +865,7 @@ Mithril = m = new function app(window, undefined) {
|
|||
if (maybeXhr != null) xhr = maybeXhr
|
||||
}
|
||||
|
||||
xhr.send(options.method == "GET" ? "" : options.data)
|
||||
xhr.send(options.method == "GET" || !options.data ? "" : options.data)
|
||||
return xhr
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue