module WEBrick::HTTPStatus
This module is used to manager HTTP status codes.
See www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more information.
This module is used to manager HTTP status codes.
See www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for more information.
Constants
- RC_ACCEPTED
- RC_BAD_GATEWAY
- RC_BAD_REQUEST
- RC_CONFLICT
- RC_CONTINUE
- RC_CREATED
- RC_EXPECTATION_FAILED
- RC_FAILED_DEPENDENCY
- RC_FORBIDDEN
- RC_FOUND
- RC_GATEWAY_TIMEOUT
- RC_GONE
- RC_HTTP_VERSION_NOT_SUPPORTED
- RC_INSUFFICIENT_STORAGE
- RC_INTERNAL_SERVER_ERROR
- RC_LENGTH_REQUIRED
- RC_LOCKED
- RC_METHOD_NOT_ALLOWED
- RC_MOVED_PERMANENTLY
- RC_MULTIPLE_CHOICES
- RC_MULTI_STATUS
- RC_NETWORK_AUTHENTICATION_REQUIRED
- RC_NON_AUTHORITATIVE_INFORMATION
- RC_NOT_ACCEPTABLE
- RC_NOT_FOUND
- RC_NOT_IMPLEMENTED
- RC_NOT_MODIFIED
- RC_NO_CONTENT
- RC_OK
- RC_PARTIAL_CONTENT
- RC_PAYMENT_REQUIRED
- RC_PRECONDITION_FAILED
- RC_PRECONDITION_REQUIRED
- RC_PROXY_AUTHENTICATION_REQUIRED
- RC_REQUEST_ENTITY_TOO_LARGE
- RC_REQUEST_HEADER_FIELDS_TOO_LARGE
- RC_REQUEST_RANGE_NOT_SATISFIABLE
- RC_REQUEST_TIMEOUT
- RC_REQUEST_URI_TOO_LARGE
- RC_RESET_CONTENT
- RC_SEE_OTHER
- RC_SERVICE_UNAVAILABLE
- RC_SWITCHING_PROTOCOLS
- RC_TEMPORARY_REDIRECT
- RC_TOO_MANY_REQUESTS
- RC_UNAUTHORIZED
- RC_UNAVAILABLE_FOR_LEGAL_REASONS
- RC_UNPROCESSABLE_ENTITY
- RC_UNSUPPORTED_MEDIA_TYPE
- RC_UPGRADE_REQUIRED
- RC_USE_PROXY
Public Class Methods
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpstatus.rb, line 186 def self.[](code) CodeToError[code] end
Returns the status class corresponding to code
WEBrick::HTTPStatus[302] => WEBrick::HTTPStatus::NotFound
Returns the status class corresponding to +code+
WEBrick::HTTPStatus => WEBrick::HTTPStatus::NotFound
(Integer code) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpstatus.rb, line 170 def client_error?(code) code.to_i >= 400 and code.to_i < 500 end
Is code a client error status?
Is +code+ a client error status?
(Integer code) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpstatus.rb, line 164 def error?(code) code.to_i >= 400 and code.to_i < 600 end
Is code an error status?
Is +code+ an error status?
(Integer code) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpstatus.rb, line 146 def info?(code) code.to_i >= 100 and code.to_i < 200 end
Is code an informational status?
Is +code+ an informational status?
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpstatus.rb, line 140 def reason_phrase(code) StatusMessage[code.to_i] end
Returns the description corresponding to the HTTP status code
WEBrick::HTTPStatus.reason_phrase 404 => "Not Found"
Returns the description corresponding to the HTTP status +code+
WEBrick::HTTPStatus.reason_phrase 404 => โNot Foundโ
(Integer code) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpstatus.rb, line 158 def redirect?(code) code.to_i >= 300 and code.to_i < 400 end
Is code a redirection status?
Is +code+ a redirection status?
(Integer code) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpstatus.rb, line 176 def server_error?(code) code.to_i >= 500 and code.to_i < 600 end
Is code a server error status?
Is +code+ a server error status?
(Integer code) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/webrick-1.9.2/lib/webrick/httpstatus.rb, line 152 def success?(code) code.to_i >= 200 and code.to_i < 300 end
Is code a successful status?
Is +code+ a successful status?