Skip to content

Instantly share code, notes, and snippets.

@ryansch
Created May 21, 2014 17:37
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 ryansch/ba7e40bf0f8e08e9bc20 to your computer and use it in GitHub Desktop.
Save ryansch/ba7e40bf0f8e08e9bc20 to your computer and use it in GitHub Desktop.
Simple http server for testing headers
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