4

HTTP status code symbols for Rails

 1 year ago
source link: https://gist.github.com/mlanett/a31c340b132ddefa9cca
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

artur-intech commented on Aug 3, 2019

edited

No 3rd party code needed:

require 'net/http'

p Net::HTTPResponse::CODE_TO_OBJ

=> {"100"=>Net::HTTPContinue, "101"=>Net::HTTPSwitchProtocol, "200"=>Net::HTTPOK, "201"=>Net::HTTPCreated, "202"=>Net::HTTPAccepted, "203"=>Net::HTTPNonAuthoritativeInformation, "204"=>Net::HTTPNoContent, "205"=>Net::HTTPResetContent, "206"=>Net::HTTPPartialContent, "207"=>Net::HTTPMultiStatus, "226"=>Net::HTTPIMUsed, "300"=>Net::HTTPMultipleChoices, "301"=>Net::HTTPMovedPermanently, "302"=>Net::HTTPFound, "303"=>Net::HTTPSeeOther, "304"=>Net::HTTPNotModified, "305"=>Net::HTTPUseProxy, "307"=>Net::HTTPTemporaryRedirect, "308"=>Net::HTTPPermanentRedirect, "400"=>Net::HTTPBadRequest, "401"=>Net::HTTPUnauthorized, "402"=>Net::HTTPPaymentRequired, "403"=>Net::HTTPForbidden, "404"=>Net::HTTPNotFound, "405"=>Net::HTTPMethodNotAllowed, "406"=>Net::HTTPNotAcceptable, "407"=>Net::HTTPProxyAuthenticationRequired, "408"=>Net::HTTPRequestTimeOut, "409"=>Net::HTTPConflict, "410"=>Net::HTTPGone, "411"=>Net::HTTPLengthRequired, "412"=>Net::HTTPPreconditionFailed, "413"=>Net::HTTPRequestEntityTooLarge, "414"=>Net::HTTPRequestURITooLong, "415"=>Net::HTTPUnsupportedMediaType, "416"=>Net::HTTPRequestedRangeNotSatisfiable, "417"=>Net::HTTPExpectationFailed, "422"=>Net::HTTPUnprocessableEntity, "423"=>Net::HTTPLocked, "424"=>Net::HTTPFailedDependency, "426"=>Net::HTTPUpgradeRequired, "428"=>Net::HTTPPreconditionRequired, "429"=>Net::HTTPTooManyRequests, "431"=>Net::HTTPRequestHeaderFieldsTooLarge, "500"=>Net::HTTPInternalServerError, "501"=>Net::HTTPNotImplemented, "502"=>Net::HTTPBadGateway, "503"=>Net::HTTPServiceUnavailable, "504"=>Net::HTTPGatewayTimeOut, "505"=>Net::HTTPVersionNotSupported, "507"=>Net::HTTPInsufficientStorage, "511"=>Net::HTTPNetworkAuthenticationRequired}


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK