当为 cordova 构建时,我的Axios请求失败,状态为404。
当我在本地进行类星体开发时,
我尝试查找跟踪中的差异,唯一的差异是请求来自Android
从构建:
{
"message":"Request failed with status code 404",
"name":"Error",
"stack":"Error: Request failed with status code 404\n at createError (file:///android_asset/www/assets/axios.f16702dc.js:263:15)\n at settle (file:///android_asset/www/assets/axios.f16702dc.js:272:12)\n at XMLHttpRequest.onloadend (file:///android_asset/www/assets/axios.f16702dc.js:451:7)",
"config":{
"url":"api/registration-stages",
"method":"post",
"data":"{\"stage\":1,\"first_name\":\"\",\"middle_name\":\"\",\"last_name\":\"\",\"email_address\":\"\",\"date_of_birth\":\"\"}",
"headers":{
"Accept":"application/json",
"Content-Type":"application/json",
"api-key":"AAA"
},
"baseURL":"https://velvet.globexfrance.com/",
"transformRequest":[
null
],
"transformResponse":[
null
],
"timeout":0,
"xsrfCookieName":"XSRF-TOKEN",
"xsrfHeaderName":"X-XSRF-TOKEN",
"maxContentLength":-1,
"maxBodyLength":-1,
"transitional":{
"silentJSONParsing":true,
"forcedJSONParsing":true,
"clarifyTimeoutError":false
}
}
}
使用错误的url(“api/registration-stageas”)在本地强制跟踪404:
{
"message":"Request failed with status code 404",
"name":"Error",
"stack":"Error: Request failed with status code 404\n at createError (http://localhost:9000/node_modules/.q-cache/vite/spa/deps/axios.js?v=cc902d62:311:19)\n at settle (http://localhost:9000/node_modules/.q-cache/vite/spa/deps/axios.js?v=cc902d62:327:16)\n at XMLHttpRequest.onloadend (http://localhost:9000/node_modules/.q-cache/vite/spa/deps/axios.js?v=cc902d62:555:11)",
"config":{
"url":"api/registration-stageas",
"method":"post",
"data":"{\"stage\":1,\"first_name\":\"\",\"middle_name\":\"\",\"last_name\":\"\",\"email_address\":\"\",\"date_of_birth\":\"\"}",
"headers":{
"Accept":"application/json",
"Content-Type":"application/json",
"api-key":"AAA"
},
"baseURL":"https://velvet.globexfrance.com/",
"transformRequest":[
null
],
"transformResponse":[
null
],
"timeout":0,
"xsrfCookieName":"XSRF-TOKEN",
"xsrfHeaderName":"X-XSRF-TOKEN",
"maxContentLength":-1,
"maxBodyLength":-1,
"transitional":{
"silentJSONParsing":true,
"forcedJSONParsing":true,
"clarifyTimeoutError":false
}
}
}
如果有人能理解为什么会发生这种情况Quasar v1.1.2 Vue v3 Cordova 11.0.0
1条答案
按热度按时间siv3szwd1#
问题是我需要cordova插件
1.3.5“白名单”