diff --git a/src/platforms/mp-alipay/runtime/api/protocols.js b/src/platforms/mp-alipay/runtime/api/protocols.js index 655a79f3eabf87e20bb3a4aafe415d2f49b02c6f..9f7377de4a0c1168344c3f9080dbfdac81460e5d 100644 --- a/src/platforms/mp-alipay/runtime/api/protocols.js +++ b/src/platforms/mp-alipay/runtime/api/protocols.js @@ -89,19 +89,32 @@ const protocols = { // 需要做转换的 API 列表 if (!fromArgs.header) { // 默认增加 header 参数,方便格式化 content-type fromArgs.header = {} } + const headers = { + 'content-type': 'application/json' + } + Object.keys(fromArgs.header).forEach(key => { + headers[key.toLocaleLowerCase()] = fromArgs.header[key] + }) return { header (header = {}, toArgs) { - const headers = { - 'content-type': 'application/json' - } - Object.keys(header).forEach(key => { - headers[key.toLocaleLowerCase()] = header[key] - }) return { name: 'headers', value: headers } }, + data (data) { + // 钉钉在content-type为application/json时,不会自动序列化 + if (my.dd && headers['content-type'].indexOf('application/json') === 0) { + return { + name: 'data', + value: JSON.stringify(data) + } + } + return { + name: 'data', + value: data + } + }, method: 'method', // TODO 支付宝小程序仅支持 get,post responseType: false }