Class: Rack::Request

Inherits:
Object
  • Object
show all
Includes:
Env, Helpers
Defined in:
lib/rack/request.rb

Overview

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"]

Defined Under Namespace

Modules: Env, Helpers

Constant Summary

Constants included from Helpers

Helpers::DEFAULT_PORTS, Helpers::FORM_DATA_MEDIA_TYPES, Helpers::HTTP_X_FORWARDED_HOST, Helpers::HTTP_X_FORWARDED_PORT, Helpers::HTTP_X_FORWARDED_PROTO, Helpers::HTTP_X_FORWARDED_SCHEME, Helpers::HTTP_X_FORWARDED_SSL, Helpers::PARSEABLE_DATA_MEDIA_TYPES

Instance Attribute Summary

Attributes included from Env

#env

Instance Method Summary collapse

Methods included from Helpers

#GET, #POST, #[], #[]=, #accept_encoding, #accept_language, #authority, #base_url, #body, #content_charset, #content_length, #content_type, #cookies, #delete?, #form_data?, #fullpath, #get?, #head?, #host, #host_with_port, #ip, #link?, #logger, #media_type, #media_type_params, #multithread?, #options?, #parseable_data?, #patch?, #path, #path_info, #path_info=, #port, #post?, #put?, #query_string, #referer, #request_method, #scheme, #script_name, #script_name=, #session, #session_options, #ssl?, #trace?, #trusted_proxy?, #unlink?, #url, #user_agent, #values_at, #xhr?

Methods included from Env

#add_header, #delete_header, #each_header, #fetch_header, #get_header, #has_header?, #initialize_copy, #set_header

Constructor Details

#initialize(env) ⇒ Request



14
15
16
17
# File 'lib/rack/request.rb', line 14

def initialize(env)
  @params = nil
  super(env)
end

Instance Method Details

#delete_param(k) ⇒ Object



28
29
30
31
32
# File 'lib/rack/request.rb', line 28

def delete_param(k)
  v = super
  @params = nil
  v
end

#paramsObject



19
20
21
# File 'lib/rack/request.rb', line 19

def params
  @params ||= super
end

#update_param(k, v) ⇒ Object



23
24
25
26
# File 'lib/rack/request.rb', line 23

def update_param(k, v)
  super
  @params = nil
end