class Rack::Request

Rack::Request provides a convenient interface to a Rack environment. It is stateless, the environment env passed to the constructor will be directly modified.

req = Rack::Request.new(env)
req.post?
req.params["data"]

Constants

ALLOWED_SCHEMES

Attributes

The priority when checking forwarded headers. The default is [:forwarded, :x_forwarded], which means, check the Forwarded header first, followed by the appropriate X-Forwarded-* header. You can revert the priority by reversing the priority, or remove checking of either or both headers by removing elements from the array.

This should be set as appropriate in your environment based on what reverse proxies are in use. If you are not using reverse proxies, you should probably use an empty array.

The priority when checking either the X-Forwarded-Proto or X-Forwarded-Scheme header for the forwarded protocol. The default is [:proto, :scheme], to try the X-Forwarded-Proto header before the X-Forwarded-Scheme header. Rack 2 had behavior similar to [:scheme, :proto]. You can remove either or both of the entries in array to ignore that respective header.

Public Class Methods

# File lib/rack/request.rb, line 62
def initialize(env)
  @env = env
  @params = nil
end

Public Instance Methods

Calls superclass method Rack::Request::Helpers#delete_param
# File lib/rack/request.rb, line 76
def delete_param(k)
  v = super
  @params = nil
  v
end
Calls superclass method Rack::Request::Helpers#params
# File lib/rack/request.rb, line 67
def params
  @params ||= super
end
Calls superclass method Rack::Request::Helpers#update_param
# File lib/rack/request.rb, line 71
def update_param(k, v)
  super
  @params = nil
end