Module: Rack::Response::Helpers
- Included in:
- Rack::Response
- Defined in:
- rack/rack/response.rb
Instance Attribute Summary (collapse)
-
- (void) headers
readonly
Headers.
-
- (void) original_headers
readonly
Headers.
Instance Method Summary (collapse)
- - (Boolean) bad_request?
- - (Boolean) client_error?
- - (void) content_length
- - (void) content_type
- - (Boolean) forbidden?
- - (Boolean) include?(header)
- - (Boolean) informational?
- - (Boolean) invalid?
- - (void) location
- - (Boolean) method_not_allowed?
- - (Boolean) not_found?
- - (Boolean) ok?
- - (Boolean) redirect?
- - (Boolean) redirection?
- - (Boolean) server_error?
- - (Boolean) successful?
- - (Boolean) unprocessable?
Instance Attribute Details
- (void) headers (readonly)
Headers
133 134 135 |
# File 'rack/rack/response.rb', line 133 def headers @headers end |
- (void) original_headers (readonly)
Headers
133 134 135 |
# File 'rack/rack/response.rb', line 133 def original_headers @original_headers end |
Instance Method Details
- (Boolean) bad_request?
124 |
# File 'rack/rack/response.rb', line 124 def bad_request?; status == 400; end |
- (Boolean) client_error?
120 |
# File 'rack/rack/response.rb', line 120 def client_error?; status >= 400 && status < 500; end |
- (void) content_length
143 144 145 146 |
# File 'rack/rack/response.rb', line 143 def content_length cl = headers["Content-Length"] cl ? cl.to_i : cl end |
- (void) content_type
139 140 141 |
# File 'rack/rack/response.rb', line 139 def content_type headers["Content-Type"] end |
- (Boolean) forbidden?
125 |
# File 'rack/rack/response.rb', line 125 def forbidden?; status == 403; end |
- (Boolean) include?(header)
135 136 137 |
# File 'rack/rack/response.rb', line 135 def include?(header) !!headers[header] end |
- (Boolean) informational?
117 |
# File 'rack/rack/response.rb', line 117 def informational?; status >= 100 && status < 200; end |
- (Boolean) invalid?
115 |
# File 'rack/rack/response.rb', line 115 def invalid?; status < 100 || status >= 600; end |
- (void) location
148 149 150 |
# File 'rack/rack/response.rb', line 148 def location headers["Location"] end |
- (Boolean) method_not_allowed?
127 |
# File 'rack/rack/response.rb', line 127 def method_not_allowed?; status == 405; end |
- (Boolean) not_found?
126 |
# File 'rack/rack/response.rb', line 126 def not_found?; status == 404; end |
- (Boolean) ok?
123 |
# File 'rack/rack/response.rb', line 123 def ok?; status == 200; end |
- (Boolean) redirect?
130 |
# File 'rack/rack/response.rb', line 130 def redirect?; [301, 302, 303, 307].include? status; end |
- (Boolean) redirection?
119 |
# File 'rack/rack/response.rb', line 119 def redirection?; status >= 300 && status < 400; end |
- (Boolean) server_error?
121 |
# File 'rack/rack/response.rb', line 121 def server_error?; status >= 500 && status < 600; end |
- (Boolean) successful?
118 |
# File 'rack/rack/response.rb', line 118 def successful?; status >= 200 && status < 300; end |
- (Boolean) unprocessable?
128 |
# File 'rack/rack/response.rb', line 128 def unprocessable?; status == 422; end |