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 61 def initialize(env) @env = env @params = nil end
Public Instance Methods
# File lib/rack/request.rb, line 75 def delete_param(k) v = super @params = nil v end
# File lib/rack/request.rb, line 66 def params @params ||= super end
# File lib/rack/request.rb, line 70 def update_param(k, v) super @params = nil end