Coder Social home page Coder Social logo

masterkain / net-http-spy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martinbtt/net-http-spy

3.0 3.0 2.0 92 KB

Ever wondered what HTTP requests the Ruby gem you are using to connect to a third party API is making? Use HTTP Spy to see what is going on behind the scenes

Home Page: http://github.com/martinbtt/net-http-spy

Ruby 100.00%

net-http-spy's Introduction

About

Ever wondered what HTTP requests the Ruby gem you are using to connect to a third party API is making? Use HTTP Spy to see what is going on behind the scenes.

Installation

sudo gem install martinbtt-net-http-spy

Example Usage

require 'rubygems'
require 'twitter'
gem 'net-http-spy'
require 'net-http-spy'

Twitter::Search.new('httparty').each { |r| r }
# Outputs...
-- : CONNECT: ["search.twitter.com", 80]
-- : GET /search.json?q=httparty
-- : BODY: Net::HTTPOK

See the examples folder for more.

Further Options

Show the call trace to the originating line of code in the third party gem

Net::HTTP.http_logger_options = {:trace => true}

Output the body of the request

Net::HTTP.http_logger_options = {:body => true}

Show the full raw HTTP output

Net::HTTP.http_logger_options = {:verbose => true}

Change the logger. By default HTTP spy logs to STDOUT

Net::HTTP.http_logger = Logger.new('twitter.log')

Bonus Points

Use it to grab sample data for FakeWeb = testing goodness.

Notes

This is a pretty early release. I'm sure there is plenty that can be done to improve compatibility as several libraries call Net::HTTP in a slightly different way. Feel free to fork and send in pull requests/patches.

Find Me

Martin Sadler (martin -- at -- beyondthetype.com)

net-http-spy's People

Contributors

martinbtt avatar masterkain avatar

Stargazers

Daniel Leavitt avatar Krzysztof Kowalik avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

nu7hatch

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.