AxiosError {message: 'Request failed with status code 404', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}code: "ERR_BAD_REQUEST"
config: {transitional: {…}, transformRequest: Array(1), transformResponse: Array(1), timeout: 0, adapter: ƒ, …}
message: "Request failed with status code 404"
name: "AxiosError"
request: XMLHttpRequest {onreadystatechange: null, readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, …}
response: {data: {…}, status: 404, statusText: 'Not Found', headers: {…}, config: {…}, …}
[[Prototype]]: Errorconstructor: ƒ AxiosError(message, code, config, request, response)
toJSON: ƒ toJSON()
isAxiosError: true
[[Prototype]]: Object

 今天同桌遇到这个bug 登录发请求有问题 我下意识看到404以为是传参问题

后来看了下 其他人写的状态码 

遇到404主要是url的问题

后来我们发现这个是接口和baseURL不匹配导致的 简单来说就是接口问题

请求错误问题:

400:传参问题;

404:url问题,查看请求地址是否正确

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐