Merge pull request #1645 from shibukawa/fix/request_use_body

When method is GET and TRACE, useBody becomes always false
This commit is contained in:
Leo Horie 2017-02-23 18:39:26 -05:00 committed by GitHub
commit d29c16e0a6

View file

@ -43,7 +43,7 @@ module.exports = function($window, Promise) {
if (args.method == null) args.method = "GET"
args.method = args.method.toUpperCase()
var useBody = typeof args.useBody === "boolean" ? args.useBody : args.method !== "GET" && args.method !== "TRACE"
var useBody = (args.method === "GET" || args.method === "TRACE") ? false : (typeof args.useBody === "boolean" ? args.useBody : true)
if (typeof args.serialize !== "function") args.serialize = typeof FormData !== "undefined" && args.data instanceof FormData ? function(value) {return value} : JSON.stringify
if (typeof args.deserialize !== "function") args.deserialize = deserialize