Last active
August 29, 2015 14:02
-
-
Save ixti/ec192b521b6478e59601 to your computer and use it in GitHub Desktop.
Tiny echo-server I use to investigate OAuth callback responses :D
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 "erb" | |
begin | |
require "awesome_print" | |
rescue LoadError | |
puts "Install Awesome Print first:" | |
puts | |
puts " gem install awesome_print" | |
puts | |
exit 1 | |
end | |
TEMPLATE = ERB.new <<HTML | |
<!doctype html> | |
<head><meta charset="utf-8" /></head> | |
<body> | |
<h1>ENV</h1> | |
<%= env.ai :html => true %> | |
<h1>QUERY</h1> | |
<%= Rack::Request.new(env).params.ai :html => true %> | |
</body> | |
</html> | |
HTML | |
HEADERS = { "Content-Type" => "text/html" } | |
run lambda { |env| [200, HEADERS, [TEMPLATE.result(binding)]] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment