Skip to content

Instantly share code, notes, and snippets.

@revans
Last active January 19, 2018 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save revans/44353fe935409b2045c9e03662d0e88c to your computer and use it in GitHub Desktop.
Save revans/44353fe935409b2045c9e03662d0e88c to your computer and use it in GitHub Desktop.
Rails Status Codes
STATUS_CODES = {
100 => :continue,
101 => :switching_protocols,
102 => :processing,
200 => :ok,
201 => :created,
202 => :accepted,
203 => :non_authoritative_information,
204 => :no_content,
205 => :reset_content,
206 => :partial_content,
207 => :multi_status,
226 => :im_used,
300 => :multiple_choices,
301 => :moved_permanently,
302 => :found,
303 => :see_other,
304 => :not_modified,
305 => :use_proxy,
307 => :temporary_redirect,
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,
412 => :precondition_failed,
413 => :request_entity_too_large,
414 => :request_uri_too_long,
415 => :unsupported_media_type,
416 => :requested_range_not_satisfiable,
417 => :expectation_failed,
422 => :unprocessable_entity,
423 => :locked,
424 => :failed_dependency,
426 => :upgrade_required,
500 => :internal_server_error,
501 => :not_implemented,
502 => :bad_gateway,
503 => :service_unavailable,
504 => :gateway_timeout,
505 => :http_version_not_supported,
507 => :insufficient_storage,
510 => :not_extended
}
STATUS_CODES = {
100 => { title: "Continue", code: :continue },
101 => { title: "Switching Protocols", code: :switching_protocols },
102 => { title: "Processing", code: :processing },
200 => { title: "OK", code: :ok },
201 => { title: "Created", code: :created },
202 => { title: "Accepted", code: :accepted },
203 => { title: "Non-Authoritative Information", code: :non_authoritative_information },
204 => { title: "No Content", code: :no_content },
205 => { title: "Reset Content", code: :reset_content },
206 => { title: "Partial Content", code: :partial_content },
207 => { title: "Multi-Status", code: :multi_status },
226 => { title: "IM Used", code: :im_used },
300 => { title: "Multiple Choices", code: :multiple_choices },
301 => { title: "Moved Permanently",code: :moved_permanently },
302 => { title: "Found", code: :found },
303 => { title: "See Other", code: :see_other },
304 => { title: "Not Modified", code: :not_modified },
305 => { title: "Use Proxy", code: :use_proxy },
307 => { title: "Temporary Redirect", code: :temporary_redirect },
400 => { title: "Bad Request", code: :bad_request },
401 => { title: "Unauthorized", code: :unauthorized },
402 => { title: "Payment Required", code: :payment_required },
403 => { title: "Forbidden", code: :forbidden },
404 => { title: "Not Found", code: :not_found },
405 => { title: "Method Not Allowed", code: :method_not_allowed },
406 => { title: "Not Acceptable", code: :not_acceptable },
407 => { title: "Proxy Authentication Required", code: :proxy_authentication_required },
408 => { title: "Request Timeout", code: :request_timeout },
409 => { title: "Conflict", code: :conflict },
410 => { title: "Gone", code: :gone },
411 => { title: "Length Required", code: :length_required },
412 => { title: "Precondition Failed", code: :precondition_failed },
413 => { title: "Request Entity Too Large", code: :request_entity_too_large },
414 => { title: "Request-URI Too Long", code: :request_uri_too_long },
415 => { title: "Unsupported Media Type", code: :unsupported_media_type },
416 => { title: "Requested Range Not Satisfiable", code: :requested_range_not_satisfiable },
417 => { title: "Expectation Failed", code: :expectation_failed },
422 => { title: "Unprocessable Entity", code: :unprocessable_entity },
423 => { title: "Locked", code: :locked },
424 => { title: "Failed Dependency", code: :failed_dependency },
426 => { title: "Upgrade Required", code: :upgrade_required },
500 => { title: "Internal Server Error", code: :internal_server_error },
501 => { title: "Not Implemented", code: :not_implemented },
502 => { title: "Bad Gateway", code: :bad_gateway },
503 => { title: "Service Unavailable", code: :service_unavailable },
504 => { title: "Gateway Timeout", code: :gateway_timeout },
505 => { title: "HTTP Version Not Supported", code: :http_version_not_supported },
507 => { title: "Insufficient Storage", code: :insufficient_storage },
510 => { title: "Not Extended", code: :not_extended }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment