0

I tried to use Rails method request.headers["Access-Token"] to get Access-Token from Headers and move it to Body. But the problem is that headers' output looks like this:

https://pp.vk.me/c638121/v638121746/239b4/PF4NFzGBTio.jpg

Is there any way to access Access-Token from headers?

  • Is that the same response from `request.headers`? – teddybear Feb 08 '17 at 15:46
  • yup, it's the output of `request.headers`. And if I access access-token like this `request.headers["Access-Token"]` it returns nil – Roman Kanafotskiy Feb 08 '17 at 15:54
  • Try `request.header['access-token']` – teddybear Feb 08 '17 at 16:02
  • @user3693398 The commenter below suggested the same. Didn't work. Someone suggested this " Ok now the hard part is finding how deeply it is nested. At the very least it is @header[:access_token] however if that doesn't work you have to find out how many hashes/arrays it is inside and basically work your way to it. For instance it could be response[:something][:another_array][:another_hash][:header]‌​[:access_token]". But there's almost no way to know how deeply it's nested – Roman Kanafotskiy Feb 09 '17 at 08:35

1 Answers1

0

It seems just wrong the case of your key. This should work

request.headers["access-token"]
Ursus
  • 29,643
  • 3
  • 33
  • 50