提交 8cad60e2 编写于 作者: Q qiang

fix: app-native request Content-Type=application/x-www-form-urlencoded fixed #1100

上级 0c850690
......@@ -30,6 +30,16 @@ export function createRequestTaskById (requestTaskId, {
if (!hasContentType && name.toLowerCase() === 'content-type') {
hasContentType = true
headers['Content-Type'] = header[name]
// TODO 需要重构
if (method === 'POST' && header[name].indexOf('application/x-www-form-urlencoded') === 0) {
let bodyArray = []
for (let key in data) {
if (data.hasOwnProperty(key)) {
bodyArray.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]))
}
}
data = bodyArray.join('&')
}
} else {
headers[name] = header[name]
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册