0

So really just asking a YES / NO question here; I have seen this: Accessing custom header variables in Ruby on Rails which answers the question below. But is this true? It seems like it shouldn't be. What was the thinking behind this?


background question

We were testing an auth scheme and when we started dumping raw http headers what I thought should be request.headers["X-auth_token"] was in fact request.headers["HTTP_X_AUTH_TOKEN"].

Is this correct?

ie

curl -H 'X-auth_token: abc123' -X POST https://www.domain.com/arc/v1/api/toggle_as_liked/4742/item

would have a request.headers["HTTP_X_AUTH_TOKEN"] value but not a request.headers["X-auth_token"] value

Community
  • 1
  • 1
timpone
  • 17,029
  • 31
  • 103
  • 200

1 Answers1

0

Yes, request.headers["HTTP_X_AUTH_TOKEN"] is correct. It will read the X-Auth-Token header, the x_auth-token header, etc.

Ben Aubin
  • 4,879
  • 2
  • 30
  • 53