Created
May 21, 2014 17:37
-
-
Save ryansch/ba7e40bf0f8e08e9bc20 to your computer and use it in GitHub Desktop.
Simple http server for testing headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'webrick' | |
puts "Starting server" | |
server = WEBrick::HTTPServer.new Port: 8000 | |
server.mount_proc '/' do |req, res| | |
req.each do |header, val| | |
puts "#{header} = #{val}" | |
end | |
res.body = "Hello World" | |
end | |
trap("INT"){ server.shutdown } | |
server.start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment