From 3be2f5587b9e1850b07c6d6ab104701222c00010 Mon Sep 17 00:00:00 2001 From: wangyaqi Date: Fri, 6 Mar 2020 21:32:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dcontent-type=E6=9C=AA?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E5=A4=A7=E5=B0=8F=E5=86=99=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/service/api/network/request.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/service/api/network/request.js b/src/core/service/api/network/request.js index 5360b715d..cb5b77281 100644 --- a/src/core/service/api/network/request.js +++ b/src/core/service/api/network/request.js @@ -100,7 +100,14 @@ class RequestTask { } export function request (args, callbackId) { - if (args.method !== 'GET' && args.header['Content-Type'].indexOf('application/json') === 0 && isPlainObject(args.data)) { + let contentType + for (const name in args.header) { + if (name.toLowerCase() === 'content-type') { + contentType = args.header[name] + break + } + } + if (args.method !== 'GET' && contentType.indexOf('application/json') === 0 && isPlainObject(args.data)) { args.data = JSON.stringify(args.data) } const { -- GitLab