0
使用dojo/store/JsonRest
發佈到REST API時,我收到以下錯誤。 我使用"X-Requested-With": null
以避免預檢請求,但我仍然收到此錯誤。請求標題字段If-None-Match在預檢響應中不被Access-Control-Allow-Headers允許
API完全支持CORS。
任何想法如何解決?
請求標頭字段如果-Next-Match不被 允許在預檢響應中使用Access-Control-Allow-Headers。
var store = new JsonRest({
target: 'https://api.xxx.com/data',
headers: {
"Authorization": 'Bearer ' + 'd4c72611fc43ab44a46344d907a2b96964df2c91',
"X-Requested-With": null // no prefligh
}
});
store.get('1-00').then(function (data) {
// ok works here
console.log('get', data)
});
// post request
store.add({name:'test'}).then(function (data) {
// error here
console.log('add', data)
});