这两天在工作中遇到一个问题,一个请求返回400错误,我需要向用户展示后端返回的错误信息,但是用普通的catch方法只能获取到浏览器返回的400错误提示,不能获取到后端返回的,后经查阅得出下面方法: axios.get('/user/12345') .catch(function (error) { if (error.response) { // The request was made and the server responded with a status code // that fa
HTTP的状态码有很多种,主要有1xx(临时响应).2xx(成功).3xx(已重定向).4xx(请求错误)以及5xx(服务器错误)五个大类,每个大类还对应一些具体的分类.平时我们接触比较多的是200.400.500等. 这里我们主要讨论一下状态码204,在HTTP RFC 2616中关于204的描述如下: If the client is a user agent, it SHOULD NOT change its document view from that which caused the
200 - OK,服务器成功返回网页 - Standard response for successful HTTP requests. 301 - Moved Permanently(永久跳转),请求的网页已永久跳转到新位置. - This and all future requests should be directed to the given. 403 - Forbidden(禁止访问),服务器拒绝请求 - forbidden request (matches a
一些常见的http状态码 200 - OK,服务器成功返回网页 - Standard response for successful HTTP requests. 301 - Moved Permanently(永久跳转),请求的网页已永久跳转到新位置. - This and all future requests should be directed to the given. 403 - Forbidden(禁止访问),服务器拒绝请求 - forbidden reques