HTTP 状态码
虽然大部分开发都没有严格遵守这套规则,但还是记录一下。
- 1xx:提供信息
- 100 continue;
- 101 switch protocol(切换协议,例如:websockey);
- 2xx:成功
- 200 OK
- 201 Created 已创建,更多和 post 请求一起;
- 202 Accepted 已接收,轮询或通知的方法告知是否成功,通常用于异步接口;
- 203 Non Authoritative Information 非权威内容,比如:内容经过中间代理服务器被修改;
- 204 No Content 没有内容;
- 205 Reset Content 重置内容;
- 206 Partial Content 服务器下发了部分内容;
- 3xx:重定向
- 300 Multiple Choices 请求了多个选项资源,共用户选择(基本不用);
- 301 Moved Permanently 永久转移,都会用 get 去请求;
- 302 Found 资源被找到(以前是临时转移);
- 303 See Other 用 get 去请求;
- 304 Not Modified 没有修改(缓存);
- 305 Use Proxy 需要代理;
- 307 Temporary Redirect 临时重新向,get -> get,post -> post,之前是什么 method,之后就用什么 method;
- 308 Permanent Redirect 永久重新向,get -> get,post -> post,之前是什么 method,之后就用什么 method;
- 4xx:客户端错误
- 400 Bad Request 请求格式错误;
- 401 Unauthorized 没有权限;
- 402 Payment Required 请先付费;
- 403 Forbidden 禁止访问;
- 404 Not Found 没有找到;
- 405 Method Not Allowed 方法不被允许;
- 406 Not Acceptable 服务端提供内容与客户端不一致,比如:编码;
- 5xx:服务端错误
- 500 Internal Server Error 内部服务器错误;
- 501 Not Implemented 没有实现;
- 502 Bad Gateway 网关错误;
- 503 Service Unavailable 服务不可用;
- 504 Gateway Timeout 网关超时;
- 505 HTTP Version Not Supported 版本不支持,比如:http1.1,http2.0;

浙公网安备 33010602011771号