Skip to content

Instantly share code, notes, and snippets.

@danhigham
Created May 29, 2014 23:45
Show Gist options
  • Select an option

  • Save danhigham/aa00751f66e625cdd73f to your computer and use it in GitHub Desktop.

Select an option

Save danhigham/aa00751f66e625cdd73f to your computer and use it in GitHub Desktop.
Simple rack app to show headers in a get request.
run Proc.new { |env|
headers = env.select {|k,v| k.start_with? 'HTTP_'}
.collect {|pair| [pair[0].sub(/^HTTP_/, ''), pair[1]]}
.collect {|pair| pair.join(": ") << "<br>"}
.sort
[200, {"Content-Type" => "text/html"}, headers]
}
source 'https://rubygems.org'
gem 'rack'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment