【发布时间】:2016-05-13 13:58:17
【问题描述】:
我正在获取这样的 URL:
fetch(url, {
mode: 'no-cors',
method: method || null,
headers: {
'Accept': 'application/json, application/xml, text/plain, text/html, *.*',
'Content-Type': 'multipart/form-data'
},
body: JSON.stringify(data) || null,
}).then(function(response) {
console.log(response.status)
console.log("response");
console.log(response)
})
我的 API 期望数据是 multipart/form-data,所以我使用的是这种类型的 content-type...但它给了我一个状态码为 400 的响应。
我的代码有什么问题?
【问题讨论】:
标签: javascript fetch fetch-api