https://developer.mozilla.org...
上面说 Content-Type可以表示客户端告诉服务端实际发送的数据类型,如果我发送的实际数据是json格式,但是Content-Type设置成其他的(比如:application/x-www-form-urlencoded, multipart/form-data),是不是也能避免option预请求?
不修改时:
改为'Content-Type': 'application/x-www-form-urlencoded'后就没有options了:
const instance = axios.create({
timeout: 15000,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
// cancelToken: source.token
});