Skip to content

Instantly share code, notes, and snippets.

@aportnov
Created March 20, 2010 18:09
Show Gist options
  • Save aportnov/338809 to your computer and use it in GitHub Desktop.
Save aportnov/338809 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
helpers do
def request_headers
env.inject({}){|acc, (k,v)| acc[$1.downcase] = v if k =~ /^http_(.*)/i; acc}
end
end
get '/headers' do
puts request_headers.inspect
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment