Class: ActionDispatch::Request
- Defined in:
- runtime/action_dispatch/request.rbs,
runtime/action_dispatch/request.rb
Instance Attribute Summary collapse
- #format ⇒ String
- #host ⇒ String
- #path ⇒ String
- #query_string ⇒ String
- #referer ⇒ String
- #remote_ip ⇒ String
- #request_method ⇒ String
-
#script_name ⇒ String
Rack's SCRIPT_NAME: the prefix the app is mounted under, "" at the root; absolute URLs built from a request include it.
Class Method Summary collapse
-
.for(env, params = {}) ⇒ Request
build a request from a Rack-shaped env hash, the test harness entry point so a controller test gets a real
controller.requestinstead of nil.
Instance Method Summary collapse
-
#base_url ⇒ String
scheme + host, no path: the base an absolute URL builds on.
- #body ⇒ RequestBody
-
#body=(value) ⇒ String
the body the transport (or the test harness) hands over is a String; what a controller reads back is the IO over it.
-
#fullpath ⇒ String
the path with its query string attached, the part an absolute URL keeps after the host.
- #get? ⇒ Boolean
-
#head? ⇒ Boolean
did the client send HEAD? It sits beside
get?because the safe-request idiom isrequest.get? || request.head?; a filter that names the predicate must find the method. -
#headers ⇒ ActionDispatch::Http::Headers
the request headers as a read-only, case-insensitive view.
-
#initialize(env = nil) ⇒ void
constructor
a fresh request; the optional env hash is copied into the internal header store.
- #original_fullpath ⇒ String
-
#original_url ⇒ String
the absolute URL of this request.
-
#params ⇒ Hash{String => Object}
the request params, keyed by String.
- #params=(value) ⇒ Hash[String, untyped]
- #post? ⇒ Boolean
-
#protocol ⇒ String
the scheme WITH its
://. -
#raw_post ⇒ String
the body as one String, cursor untouched.
- #referrer ⇒ String
-
#ssl? ⇒ Boolean
did the client connect over TLS? The server says so (
HTTPS=on), or a proxy that terminated TLS in front of us says so inX-Forwarded-Proto— a load balancer or a PaaS router. -
#url ⇒ String
the absolute URL, the name app code reaches for (a login filter stores it as the post-login return path).
-
#user_agent ⇒ String
the User-Agent header, recorded on session rows and read by bot filters.
- #user_agent=(value) ⇒ String
- #xhr? ⇒ Boolean
Constructor Details
#initialize(env = nil) ⇒ void
a fresh request; the optional env hash is copied into the internal header
store. Callers never receive the hash back — headers is the read-only
view.
111 |
# File 'runtime/action_dispatch/request.rb', line 111
def initialize: (?Hash[String, untyped] env) -> void
|
Instance Attribute Details
#query_string ⇒ String
38 |
# File 'runtime/action_dispatch/request.rbs', line 38
def query_string: () -> String
|
#referer ⇒ String
44 |
# File 'runtime/action_dispatch/request.rbs', line 44
def referer: () -> String
|
#remote_ip ⇒ String
34 |
# File 'runtime/action_dispatch/request.rbs', line 34
def remote_ip: () -> String
|
#request_method ⇒ String
42 |
# File 'runtime/action_dispatch/request.rbs', line 42
def request_method: () -> String
|
#script_name ⇒ String
Rack's SCRIPT_NAME: the prefix the app is mounted under, "" at the root; absolute URLs built from a request include it.
99 |
# File 'runtime/action_dispatch/request.rb', line 99
def script_name: () -> String
|
Class Method Details
.for(env, params = {}) ⇒ Request
build a request from a Rack-shaped env hash, the test harness entry point
so a controller test gets a real controller.request instead of nil.
289 |
# File 'runtime/action_dispatch/request.rb', line 289
def self.for: (Hash[String, untyped] env, ?Hash[String, untyped] params) -> Request
|
Instance Method Details
#base_url ⇒ String
scheme + host, no path: the base an absolute URL builds on.
225 |
# File 'runtime/action_dispatch/request.rb', line 225
def base_url: () -> String
|
#body ⇒ RequestBody
50 |
# File 'runtime/action_dispatch/request.rbs', line 50
def body: () -> RequestBody
|
#body=(value) ⇒ String
the body the transport (or the test harness) hands over is a String; what a controller reads back is the IO over it. A fresh write drops the old cursor, so a body assigned twice — the harness re-posting through one Request — starts at 0 again.
155 |
# File 'runtime/action_dispatch/request.rb', line 155
def body=: (String) -> String
|
#fullpath ⇒ String
the path with its query string attached, the part an absolute URL keeps after the host.
194 |
# File 'runtime/action_dispatch/request.rb', line 194
def fullpath: () -> String
|
#get? ⇒ Boolean
54 |
# File 'runtime/action_dispatch/request.rbs', line 54
def get?: () -> bool
|
#head? ⇒ Boolean
did the client send HEAD? It sits beside get? because the safe-request
idiom is request.get? || request.head?; a filter that names the
predicate must find the method.
182 |
# File 'runtime/action_dispatch/request.rb', line 182
def head?: () -> bool
|
#headers ⇒ ActionDispatch::Http::Headers
the request headers as a read-only, case-insensitive view. Header names
map to the internal Rack-style keys (Authorization →
HTTP_AUTHORIZATION, Content-Type → CONTENT_TYPE).
266 |
# File 'runtime/action_dispatch/request.rb', line 266
def headers: () -> ActionDispatch::Http::Headers
|
#original_fullpath ⇒ String
59 |
# File 'runtime/action_dispatch/request.rbs', line 59
def original_fullpath: () -> String
|
#original_url ⇒ String
the absolute URL of this request.
232 |
# File 'runtime/action_dispatch/request.rb', line 232
def original_url: () -> String
|
#params ⇒ Hash{String => Object}
the request params, keyed by String.
273 |
# File 'runtime/action_dispatch/request.rb', line 273
def params: () -> Hash[String, untyped]
|
#params=(value) ⇒ Hash[String, untyped]
70 |
# File 'runtime/action_dispatch/request.rbs', line 70
def params=: (Hash[String, untyped]) -> Hash[String, untyped]
|
#post? ⇒ Boolean
55 |
# File 'runtime/action_dispatch/request.rbs', line 55
def post?: () -> bool
|
#protocol ⇒ String
the scheme WITH its ://.
218 |
# File 'runtime/action_dispatch/request.rb', line 218
def protocol: () -> String
|
#raw_post ⇒ String
the body as one String, cursor untouched.
169 |
# File 'runtime/action_dispatch/request.rb', line 169
def raw_post: () -> String
|
#referrer ⇒ String
65 |
# File 'runtime/action_dispatch/request.rbs', line 65
def referrer: () -> String
|
#ssl? ⇒ Boolean
did the client connect over TLS? The server says so (HTTPS=on), or a
proxy that terminated TLS in front of us says so in X-Forwarded-Proto —
a load balancer or a PaaS router. The header is honored without
configuration, so a request behind such a proxy builds https URLs rather
than mixed-content http ones.
209 |
# File 'runtime/action_dispatch/request.rb', line 209
def ssl?: () -> bool
|
#url ⇒ String
the absolute URL, the name app code reaches for (a login filter stores it as the post-login return path). Its own method rather than an alias.
240 |
# File 'runtime/action_dispatch/request.rb', line 240
def url: () -> String
|
#user_agent ⇒ String
the User-Agent header, recorded on session rows and read by bot filters.
251 |
# File 'runtime/action_dispatch/request.rb', line 251
def user_agent: () -> String
|
#user_agent=(value) ⇒ String
67 |
# File 'runtime/action_dispatch/request.rbs', line 67
def user_agent=: (String) -> String
|
#xhr? ⇒ Boolean
57 |
# File 'runtime/action_dispatch/request.rbs', line 57
def xhr?: () -> bool
|