我尝试添加自定义标题,X-Query-Key
,对HTTP请求使用Fetch API或request但是当我加入这个请求的头出现在设置页眉失败和Request Method
设置由于某种原因到OPTIONS
。获取请求不工作
当我删除标题时,它会回到GET
,因为它应该这样做。
样品代码看起来象下面这样:
const options = {
url: url,
headers: {
'Accept': 'application/json',
'X-Query-Key': '123456' //Adding this breaks the request
}
};
return request(options, (err, res, body) => {
console.log(body);
});
听起来像CORS。 – Bergi