Skip to content

Instantly share code, notes, and snippets.

@mfilej
Created July 4, 2011 11:52
Show Gist options
  • Save mfilej/1063262 to your computer and use it in GitHub Desktop.
Save mfilej/1063262 to your computer and use it in GitHub Desktop.
inspect-headers.herokuapp.com – prints HTTP request headers (an excuse to try out heroku cedar)
require "stringio"
require "bundler"
Bundler.require
run ->(env) {
body = StringIO.new
env.sort.each do |(k, v)|
next unless k =~ /^HTTP_(\w+)/
header = $1.split("_").map(&:capitalize).join("-")
body.puts "#{header}: #{v}"
end
body.rewind
[200, { "Content-Type" => "text/plain" }, body]
}
source :rubygems
gem "rack", "~> 1.3.0"
gem "thin", "~> 1.2.7"
GEM
remote: http://rubygems.org/
specs:
daemons (1.1.0)
eventmachine (0.12.10)
rack (1.3.0)
thin (1.2.11)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
PLATFORMS
ruby
DEPENDENCIES
rack (~> 1.3.0)
thin (~> 1.2.7)
web: bundle exec thin start -p $PORT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment