Sylar
Sylar

Reputation: 12072

How to get request headers cookie in rails 5 api

Im trying to get the cookies, from the controller, with puts request.headers['Cookie'] and nothing is showing in my terminal.

My see the details in chrome tools:

enter image description here

How to get the cookie, please?

Edit

See gist for header response.

Upvotes: 3

Views: 4181

Answers (2)

just use cookies

puts cookies[:name]

Upvotes: 1

marmeladze
marmeladze

Reputation: 6564

try this

request.headers["Cookie"]

http://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-headers

Upvotes: 6

Related Questions