Skip to content
Newer
Older
100644 61 lines (37 sloc) 1.53 KB
3d7824b @martinbtt update readme formatting
authored
1 ## About
8dbbee4 @martinbtt add the main project files
authored
2
3 Ever wondered what HTTP requests the Ruby gem you are using to connect to a third party
4 API is making? Use HTTP Spy to see what is going on behind the scenes.
5
3d7824b @martinbtt update readme formatting
authored
6 ## Installation
8dbbee4 @martinbtt add the main project files
authored
7
a59e418 @martinbtt enhance readme formatting
authored
8 sudo gem install martinbtt-net-http-spy
8dbbee4 @martinbtt add the main project files
authored
9
3d7824b @martinbtt update readme formatting
authored
10 ## Example Usage
8dbbee4 @martinbtt add the main project files
authored
11
a59e418 @martinbtt enhance readme formatting
authored
12 require 'rubygems'
13 require 'twitter'
a738db2 @martinbtt update readme
authored
14 gem 'net-http-spy'
8eeca47 @martinbtt update main file name to net-http-spy and update readme and config fi…
authored
15 require 'net-http-spy'
a59e418 @martinbtt enhance readme formatting
authored
16
17 Twitter::Search.new('httparty').each { |r| r }
18 # Outputs...
19 -- : CONNECT: ["search.twitter.com", 80]
20 -- : GET /search.json?q=httparty
21 -- : BODY: Net::HTTPOK
8dbbee4 @martinbtt add the main project files
authored
22
23
24 See the examples folder for more.
25
3d7824b @martinbtt update readme formatting
authored
26 ## Further Options
8dbbee4 @martinbtt add the main project files
authored
27
3d7824b @martinbtt update readme formatting
authored
28 Show the call trace to the originating line of code in the third party gem
a59e418 @martinbtt enhance readme formatting
authored
29
30 Net::HTTP.http_logger_options = {:trace => true}
8dbbee4 @martinbtt add the main project files
authored
31
3d7824b @martinbtt update readme formatting
authored
32 Output the body of the request
a59e418 @martinbtt enhance readme formatting
authored
33
34 Net::HTTP.http_logger_options = {:body => true}
8dbbee4 @martinbtt add the main project files
authored
35
3d7824b @martinbtt update readme formatting
authored
36 Show the full raw HTTP output
a59e418 @martinbtt enhance readme formatting
authored
37
38 Net::HTTP.http_logger_options = {:verbose => true}
8dbbee4 @martinbtt add the main project files
authored
39
3d7824b @martinbtt update readme formatting
authored
40 Change the logger. By default HTTP spy logs to STDOUT
a59e418 @martinbtt enhance readme formatting
authored
41
42 Net::HTTP.http_logger = Logger.new('twitter.log')
8dbbee4 @martinbtt add the main project files
authored
43
3d7824b @martinbtt update readme formatting
authored
44 ## Bonus Points
8dbbee4 @martinbtt add the main project files
authored
45
46 Use it to grab sample data for FakeWeb = testing goodness.
47
3d7824b @martinbtt update readme formatting
authored
48 ## Notes
8dbbee4 @martinbtt add the main project files
authored
49
50 This is a pretty early release. I'm sure there is plenty that can be done to improve compatibility
51 as several libraries call Net::HTTP in a slightly different way.
52 Feel free to fork and send in pull requests/patches.
53
3d7824b @martinbtt update readme formatting
authored
54 ## Find Me
8dbbee4 @martinbtt add the main project files
authored
55
56 Martin Sadler (martin -- at -- beyondthetype.com)
57
a59e418 @martinbtt enhance readme formatting
authored
58 * Blog: http://www.beyondthetype.com
59 * Follow: http://twitter.com/martinbtt
60 * Code: http://github.com/martinbtt
61 * Recommend: http://www.workingwithrails.com/person/5152-martin-sadler
Something went wrong with that request. Please try again.