Skip to content

Instantly share code, notes, and snippets.

@justincase
Forked from ahoward/net-http-debug.rb
Created September 17, 2019 18: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 justincase/34b517b2fe2516f780e81d80c4f0e25c to your computer and use it in GitHub Desktop.
Save justincase/34b517b2fe2516f780e81d80c4f0e25c to your computer and use it in GitHub Desktop.
a simple way to debug tons of libs that use ruby's net/http
BEGIN {
require 'net/http'
Net::HTTP.module_eval do
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
ensure
@debug_output = $stderr ### if ENV['HTTP_DEBUG']
end
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment