Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 422
Sylar Avatar asked Nov 27 '25 03:11

Sylar


2 Answers

try this

request.headers["Cookie"]

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

like image 153
marmeladze Avatar answered Nov 28 '25 17:11

marmeladze


just use cookies

puts cookies[:name]
like image 29
Буянбат Чойжилсүрэн Avatar answered Nov 28 '25 17:11

Буянбат Чойжилсүрэн