我嘗試添加自定義標題,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