Skip to content

Instantly share code, notes, and snippets.

@ph3nx
Last active January 3, 2016 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ph3nx/8407835 to your computer and use it in GitHub Desktop.
Save ph3nx/8407835 to your computer and use it in GitHub Desktop.
Two code examples on how to display all request headers in Ruby on Rails.
<% request.header do |k, v| %>
"<%= k %>" => <%= v %><br>
<% end %>
<% for header in request.env.select {|k,v| k.match("^HTTP.*")} %>
"<%=header[0].split('_',2)[1]%>" => <%=header[1]%><br>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment