Created
May 15, 2015 13:40
-
-
Save migimunz/bef02ed174c42e2080c3 to your computer and use it in GitHub Desktop.
A small sinatra app that just prints the request details it gets. Useful for debugging clients and reverse proxies.
This file contains hidden or 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 'sinatra/base' | |
require 'pp' | |
class HttpDebug < Sinatra::Base | |
set :port, ARGV[0] || 8001 | |
set :logging, false | |
[:get, :put, :post, :patch, :delete, :head, :link, :unlink, :options].each do |method| | |
send(method, '*') do | |
puts "#{method.to_s.upcase} #{request.path}" | |
puts "Full URL: #{request.url}" | |
puts "Params: #{pp params}" | |
if !request.content_length.nil? | |
puts "Body:" | |
pp request.body | |
puts "-------------" | |
end | |
puts '' | |
200 | |
end | |
end | |
end | |
HttpDebug.run! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment