{"message":"{"code":201,"message":"Permission denied"}","name":"AxiosError","stack":" at AxiosError (oh_modules/.ohpm/@ohos+axios@2.2.4/oh_modules/@ohos/axios/src/main/ets/components/lib/core/AxiosError.js:22:1)\n at anonymous (oh_modules/.ohpm/@ohos+axios@2.2.4/oh_modules/@ohos/axios/src/main/ets/components/lib/adapters/ohos/http.js:57:1)\n","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["ohos"],"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{"Blob":null},"headers":{"Accept":"application/json, text/plain, /"},"method":"get","url":"http://192.168.3.55:8080/aa"},"code":201,"status":null}
使用axios请求后端网络服务出现该错误
是没有申请网络权限
在model.json5里面添加一下网络权限就好了
bash
"requestPermissions": [
{
"name": "ohos.permission.INTERNET"
}
],