HttpStatus狀態詳解,HttpStatus.OK,HttpStatus.BADREQUEST,HttpStatus.FORBIDDEN,HttpStatus.NOTFOUND等區別
阿新 • • 發佈:2018-11-14
常用HttpStatus狀態:
- HttpStatus.OK = 200;
- HttpStatus.BAD_REQUEST = 400;
- HttpStatus.FORBIDDEN = 403;
- HttpStatus.NOT_FOUND = 404;
- HttpStatus.REQUEST_TIMEOUT = 408;
- HttpStatus.SERVICE_UNAVAILABLE =500;
HttpStatus狀態碼詳解
HttpStatus = {
//Informational 1xx 資訊
'100' : 'Continue' , //繼續
'101' : 'Switching Protocols', //交換協議
//Successful 2xx 成功
'200' : 'OK', //OK
'201' : 'Created', //建立
'202' : 'Accepted', //已接受
'203' : 'Non-Authoritative Information', //非權威資訊
'204' : 'No Content', //沒有內容
'205' : 'Reset Content', //重置內容
'206' : 'Partial Content', //部分內容
//Redirection 3xx 重定向
'300' : 'Multiple Choices', //多種選擇
'301' : 'Moved Permanently', //永久移動
'302' : 'Found', //找到
'303' : 'See Other', //參見其他
'304' : 'Not Modified', //未修改
'305' : 'Use Proxy', //使用代理
'306' : 'Unused', //未使用
'307' : 'Temporary Redirect', //暫時重定向
//Client Error 4xx 客戶端錯誤
'400' : 'Bad Request', //錯誤的請求
'401' : 'Unauthorized', //未經授權
'402' : 'Payment Required', //付費請求
'403' : 'Forbidden', //禁止
'404' : 'Not Found', //沒有找到
'405' : 'Method Not Allowed', //方法不允許
'406' : 'Not Acceptable', //不可接受
'407' : 'Proxy Authentication Required', //需要代理身份驗證
'408' : 'Request Timeout', //請求超時
'409' : 'Conflict', //指令衝突
'410' : 'Gone', //文件永久地離開了指定的位置
'411' : 'Length Required', //需要Content-Length頭請求
'412' : 'Precondition Failed', //前提條件失敗
'413' : 'Request Entity Too Large', //請求實體太大
'414' : 'Request-URI Too Long', //請求URI太長
'415' : 'Unsupported Media Type', //不支援的媒體型別
'416' : 'Requested Range Not Satisfiable', //請求的範圍不可滿足
'417' : 'Expectation Failed', //期望失敗
//Server Error 5xx 伺服器錯誤
'500' : 'Internal Server Error', //內部伺服器錯誤
'501' : 'Not Implemented', //未實現
'502' : 'Bad Gateway', //錯誤的閘道器
'503' : 'Service Unavailable', //服務不可用
'504' : 'Gateway Timeout', //閘道器超時
'505' : 'HTTP Version Not Supported' //HTTP版本不支援
};
參考自
https://blog.csdn.net/csdn1844295154/article/details/78980174