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 140
140:     def cookies
141:     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 134
134:     def env
135:     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 137
137:     def host
138:     end
host_with_port()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 112
112:     def host_with_port
113:       env['HTTP_HOST'] || host + port_string
114:     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 90
90:     def path
91:       path = request_uri ? request_uri.split('?').first : ''
92: 
93:       # cut off the part of the url which leads to the installation directory of this app
94:       path[relative_url_root.length..-1]
95:     end
path_parameters()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 121
121:     def path_parameters
122:       @path_parameters ||= {}
123:     end
path_parameters=(parameters)
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 116
116:     def path_parameters=(parameters)
117:       @path_parameters = parameters
118:       @parameters = nil
119:     end
port()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 103
103:     def port
104:       env['SERVER_PORT'].to_i
105:     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 108
108:     def port_string
109:       (protocol == 'http://' && port == 80) || (protocol == 'https://' && port == 443) ? '' : ":#{port}"
110:     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 80
80:     def protocol
81:       env["HTTPS"] == "on" ? 'https://' : 'http://'
82:     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 128
128:     def query_parameters
129:     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 99
 99:     def relative_url_root
100:       File.dirname(env["SCRIPT_NAME"].to_s).gsub /(^\.$|^\/$)/, ''
101:     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 131
131:     def request_parameters
132:     end
request_uri()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 76
76:     def request_uri
77:       (%r{^\w+\://[^/]+(/.*|$)$} =~ env['REQUEST_URI']) ? $1 : env['REQUEST_URI'] # Remove domain, which webrick puts into the request_uri.
78:     end
reset_session()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 146
146:     def reset_session
147:     end
session()
     # File vendor/rails/actionpack/lib/action_controller/request.rb, line 143
143:     def session
144:     end
ssl?()
    # File vendor/rails/actionpack/lib/action_controller/request.rb, line 84
84:     def ssl?
85:       protocol == 'https://'
86:     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