module Rack::Response::Helpers

Attributes

headers[R]

Headers

original_headers[R]

Headers

Public Instance Methods

client_error?() click to toggle source
# File lib/rack/response.rb, line 117
def client_error?;  @status >= 400 && @status < 500;       end
content_length() click to toggle source
# File lib/rack/response.rb, line 138
def content_length
  cl = headers["Content-Length"]
  cl ? cl.to_i : cl
end
content_type() click to toggle source
# File lib/rack/response.rb, line 134
def content_type
  headers["Content-Type"]
end
empty?() click to toggle source
# File lib/rack/response.rb, line 125
def empty?;         [201, 204, 304].include?      @status; end
forbidden?() click to toggle source
# File lib/rack/response.rb, line 121
def forbidden?;     @status == 403;                        end
include?(header) click to toggle source
# File lib/rack/response.rb, line 130
def include?(header)
  !!headers[header]
end
informational?() click to toggle source
# File lib/rack/response.rb, line 114
def informational?; @status >= 100 && @status < 200;       end
invalid?() click to toggle source
# File lib/rack/response.rb, line 112
def invalid?;       @status < 100 || @status >= 600;       end
location() click to toggle source
# File lib/rack/response.rb, line 143
def location
  headers["Location"]
end
not_found?() click to toggle source
# File lib/rack/response.rb, line 122
def not_found?;     @status == 404;                        end
ok?() click to toggle source
# File lib/rack/response.rb, line 120
def ok?;            @status == 200;                        end
redirect?() click to toggle source
# File lib/rack/response.rb, line 124
def redirect?;      [301, 302, 303, 307].include? @status; end
redirection?() click to toggle source
# File lib/rack/response.rb, line 116
def redirection?;   @status >= 300 && @status < 400;       end
server_error?() click to toggle source
# File lib/rack/response.rb, line 118
def server_error?;  @status >= 500 && @status < 600;       end
successful?() click to toggle source
# File lib/rack/response.rb, line 115
def successful?;    @status >= 200 && @status < 300;       end