【发布时间】:2019-09-08 07:15:23
【问题描述】:
我在使用启用了keepalive 的获取API 调用POST 请求时收到错误Preflight request for request with keepalive specified is currently not supported。任何帮助,将不胜感激 。我在 beforeunload 事件上调用这个 api。
API 请求
fetch(uri, {
method: 'POST',
headers: {
'Content-type': options.headers.get('content-type'),
'Authorization': options.headers.get('authorization')
},
body: JSON.stringify(interactionBody),
keepalive: true
}).catch((e) => {
console.log(e);
});
【问题讨论】: