request.headers["Content-Type"] # => "text/plain"
replace "Content-Type" with the name of the header you want to read.
Update for Rails 4.2
There are two ways to get them in Rails 4.2: The old way (still working):
request.headers["Cookie"]
New way:
request.headers["HTTP_COOKIE"]
Get a hash with all request headers.
request.headers
Eduard Feb 06 '13 at 13:08 2013-02-06 13:08
source share