These methods are available in both the production and test Request objects.

Methods
Public Instance methods
cookies()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 156
156:     def cookies
157:     end
delete?()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 26
26:     def delete?
27:       method == :delete
28:     end
domain(tld_length = 1)

Returns the domain part of a host, such as rubyonrails.org in "www.rubyonrails.org". You can specify a different tld_length, such as 2 to catch rubyonrails.co.uk in "www.rubyonrails.co.uk".

    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 57
57:     def domain(tld_length = 1)
58:       host.split('.').last(1 + tld_length).join('.')
59:     end
env()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 150
150:     def env
151:     end
get?()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 14
14:     def get?
15:       method == :get
16:     end
head?()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 30
30:     def head?
31:       method == :head
32:     end
host()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 153
153:     def host
154:     end
host_with_port()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 120
120:     def host_with_port
121:       env['HTTP_HOST'] || host + port_string
122:     end
method()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 10
10:     def method
11:       env['REQUEST_METHOD'].downcase.intern
12:     end
parameters()

Returns both GET and POST parameters in a single hash.

   # File vendor/rails/actionpack/lib/action_controller/request.rb, line 5
5:     def parameters
6:       # puts "#{request_parameters.inspect} | #{query_parameters.inspect} | #{path_parameters.inspect}"
7:       @parameters ||= request_parameters.merge(query_parameters).merge(path_parameters).with_indifferent_access
8:     end
path()

returns the interpreted path to requested resource after all the installation directory of this application was taken into account

     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 98
 98:     def path
 99:       path = request_uri ? request_uri.split('?').first : ''
100: 
101:       # cut off the part of the url which leads to the installation directory of this app
102:       path[relative_url_root.length..-1]
103:     end
path_parameters()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 129
129:     def path_parameters
130:       @path_parameters ||= {}
131:     end
path_parameters=(parameters)
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 124
124:     def path_parameters=(parameters)
125:       @path_parameters = parameters
126:       @parameters = nil
127:     end
port()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 111
111:     def port
112:       env['SERVER_PORT'].to_i
113:     end
port_string()

Returns a string like ":8080" if the port is not 80 or 443 while on https.

     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 116
116:     def port_string
117:       (protocol == 'http://' && port == 80) || (protocol == 'https://' && port == 443) ? '' : ":#{port}"
118:     end
post?()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 18
18:     def post?
19:       method == :post
20:     end
protocol()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 88
88:     def protocol
89:       env["HTTPS"] == "on" ? 'https://' : 'http://'
90:     end
put?()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 22
22:     def put?
23:       method == :put
24:     end
query_parameters()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 144
144:     def query_parameters
145:     end
raw_post()

Receive the raw post data. This is useful for services such as REST, XMLRPC and SOAP which communicate over HTTP POST but don’t use the traditional parameter format.

    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 72
72:     def raw_post
73:       env['RAW_POST_DATA']
74:     end
relative_url_root()

returns the path minus the web server relative installation directory

     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 107
107:     def relative_url_root
108:       File.dirname(env["SCRIPT_NAME"].to_s).gsub /(^\.$|^\/$)/, ''
109:     end
remote_ip()

Determine originating IP address. REMOTE_ADDR is the standard but will fail if the user is behind a proxy. HTTP_CLIENT_IP and/or HTTP_X_FORWARDED_FOR are set by proxies so check for these before falling back to REMOTE_ADDR. HTTP_X_FORWARDED_FOR may be a comma- delimited list in the case of multiple chained proxies; the first is the originating IP.

    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 41
41:     def remote_ip
42:       return env['HTTP_CLIENT_IP'] if env.include? 'HTTP_CLIENT_IP'
43: 
44:       if env.include? 'HTTP_X_FORWARDED_FOR' then
45:         remote_ips = env['HTTP_X_FORWARDED_FOR'].split(',').reject do |ip|
46:             ip =~ /^unknown$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\./i
47:         end
48: 
49:         return remote_ips.first.strip unless remote_ips.empty?
50:       end
51: 
52:       return env['REMOTE_ADDR']
53:     end
request_parameters()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 147
147:     def request_parameters
148:     end
request_uri()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 76
76:     def request_uri
77:       unless env['REQUEST_URI'].nil?
78:         (%r{^\w+\://[^/]+(/.*|$)$} =~ env['REQUEST_URI']) ? $1 : env['REQUEST_URI'] # Remove domain, which webrick puts into the request_uri.
79:       else  # REQUEST_URI is blank under IIS - get this from PATH_INFO and SCRIPT_NAME
80:         script_filename = env["SCRIPT_NAME"].to_s.match(%r{[^/]+$})
81:         request_uri = env["PATH_INFO"]
82:         request_uri.sub!(/#{script_filename}\//, '') unless script_filename.nil?
83:         request_uri += '?' + env["QUERY_STRING"] unless env["QUERY_STRING"].nil? || env["QUERY_STRING"].empty?
84:         return request_uri
85:       end
86:      end
reset_session()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 162
162:     def reset_session
163:     end
session()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 159
159:     def session
160:     end
ssl?()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 92
92:     def ssl?
93:       protocol == 'https://'
94:     end
subdomains(tld_length = 1)

Returns all the subdomains as an array, so ["dev", "www"] would be returned for "dev.www.rubyonrails.org". You can specify a different tld_length, such as 2 to catch ["www"] instead of ["www", "rubyonrails"] in "www.rubyonrails.co.uk".

    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 64
64:     def subdomains(tld_length = 1)
65:       parts = host.split('.')
66:       parts - parts.last(1 + tld_length)
67:     end
xhr?()

Alias for xml_http_request?

xml_http_request?()

Returns true if the request’s "X-Requested-With" header contains "XMLHttpRequest". (The Prototype Javascript library sends this header with every Ajax request.)

This method is also aliased as xhr?
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 136
136:     def xml_http_request?
137:       env['HTTP_X_REQUESTED_WITH'] =~ /XMLHttpRequest/i
138:     end