我編寫了一個使用JotForm api系統的Vue.js應用程序,但在使用ApiKey獲取請求時出現錯誤。Axios GET請求錯誤
這是我的請求的代碼:
axios.get('https://api.jotform.com/user/forms', {
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'APIKEY': state.apiKey
} }).then(response => {
console.log(response)
}).catch((error) => {
console.log(error)
})
而這是錯誤消息:
請求頭字段APIKEY不是由接入控制允許接頭在預檢響應允許
我在網上搜索並嘗試添加各種標題。他們都沒有成功。同樣的獲取請求與郵差完美匹配。
[請求標頭字段Access-Control-Allow-Headers在預檢響應中本身不允許]的重複(https://stackoverflow.com/questions/32500073/request-header-field-access-control-allow -headers-is-not-allowed-by-its-in-pr) – Terry