Rails HTTP Status Code to Symbol Mapping
来源:互联网 发布:格灵深瞳 知乎 编辑:程序博客网 时间:2024/06/05 01:27
Sometimes you might need to set the HTTP response head with different status to specify the different handled results. You can do this in Rails by add a:status
to a rails method such as #respond_with
. Here list all the maps:
1xx Informational100 Continue :continue101 Switching Protocols :switching_protocols102 Processing :processing2xx Success200 OK :ok201 Created :created202 Accepted :accepted203 Non-Authoritative Information :non_authoritative_information204 No Content :no_content205 Reset Content :reset_content206 Partial Content :partial_content207 Multi-Status :multi_status226 IM Used :im_used3xx Redirection300 Multiple Choices :multiple_choices301 Moved Permanently :moved_permanently302 Found :found303 See Other :see_other304 Not Modified :not_modified305 Use Proxy :use_proxy307 Temporary Redirect :temporary_redirect4xx Client Error400 Bad Request :bad_request401 Unauthorized :unauthorized402 Payment Required :payment_required403 Forbidden :forbidden404 Not Found :not_found405 Method Not Allowed :method_not_allowed406 Not Acceptable :not_acceptable407 Proxy Authentication Required :proxy_authentication_required408 Request Timeout :request_timeout409 Conflict :conflict410 Gone :gone411 Length Required :length_required412 Precondition Failed :precondition_failed413 Request Entity Too Large :request_entity_too_large414 Request-URI Too Long :request_uri_too_long415 Unsupported Media Type :unsupported_media_type416 Requested Range Not Satisfiable :requested_range_not_satisfiable417 Expectation Failed :expectation_failed422 Unprocessable Entity :unprocessable_entity423 Locked :locked424 Failed Dependency :failed_dependency426 Upgrade Required :upgrade_required5xx Server Error500 Internal Server Error :internal_server_error501 Not Implemented :not_implemented502 Bad Gateway :bad_gateway503 Service Unavailable :service_unavailable504 Gateway Timeout :gateway_timeout505 HTTP Version Not Supported :http_version_not_supported507 Insufficient Storage :insufficient_storage510 Not Extended :not_extended
Addtionally, you can view all these on your local machine by installing the gemcheat
, and see all status codes using command cheat status_codes
.
All these informations come from internet, the codes file comes from ktkaushik's gist and other information comes from Cody Fauser's post
0 0
- Rails HTTP Status Code to Symbol Mapping
- HTTP status code in Rails
- Http status code
- HTTP Status Code
- HTTP的STATUS CODE
- http status code 206
- Http Status Code Definitions
- HTTP status Code
- 常见http status code
- HTTP的STATUS CODE
- HTTP status code
- Http status code : 304
- HTTP Status Code
- HTTP status code
- HTTP Status Code
- HTTP Status Code
- android http status code
- HTTP STATUS CODE DETAIL
- Qt备忘录
- 在O(1)时间删除链表节点
- 如何成为优秀的软件人才
- RAID简介
- CUDA1.1-函数类型限定符与变量类型限定符
- Rails HTTP Status Code to Symbol Mapping
- RANCID 入门
- android之Broadcast
- [BestCoder Round #25 1003]Harry and Christmas tree
- React.js 概览
- 判断两个增序数组是否有重复(度娘)
- 修改win32平台下窗口大小,及屏幕适配
- 32位小写MD5加密js和sha256哈希js
- ReactiveCocoa--RACDelegateProxy