Skip to content

Instantly share code, notes, and snippets.

@bsgreenb
Created December 18, 2013 09:31
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 bsgreenb/8019637 to your computer and use it in GitHub Desktop.
Save bsgreenb/8019637 to your computer and use it in GitHub Desktop.
agent.pre_connect_hooks << Proc.new do |agent, request|
puts { :method => request.method, :path => request.path, :headers => request.to_hash, :post_params => request.body }
end
agent.post_connect_hooks << Proc.new do |agent, uri, response, body|
puts { :status_code => response.code, :response_headers => response.to_hash, :mechanize_response_body => body, :mechanize_uri => uri}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment