ActionDispatch::Http::Headers

class ActionDispatch::Http::Headers

Parent:
Object
Included modules:
Enumerable

Provides access to the request's HTTP headers from the environment.

env     = { "CONTENT_TYPE" => "text/plain", "HTTP_USER_AGENT" => "curl/7.43.0" }
headers = ActionDispatch::Http::Headers.from_hash(env)
headers["Content-Type"] # => "text/plain"
headers["User-Agent"] # => "curl/7.43.0"

Also note that when headers are mapped to CGI-like variables by the Rack server, both dashes and underscores are converted to underscores. This ambiguity cannot be resolved at this stage anymore. Both underscores and dashes have to be interpreted as if they w