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
Source
# File lib/rack/request.rb, line 62 def initialize(env) @env = env @ip = nil @params = nil end
Public Instance Methods
Source
# File lib/rack/request.rb, line 81 def delete_param(k) v = super @params = nil v end
Rack::Request::Helpers#delete_param
Source
# File lib/rack/request.rb, line 68 def ip @ip ||= super end
Rack::Request::Helpers#ip
Source
# File lib/rack/request.rb, line 72 def params @params ||= super end
Rack::Request::Helpers#params
Source
# File lib/rack/request.rb, line 76 def update_param(k, v) super @params = nil end
Rack::Request::Helpers#update_param