httparty2 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +6 -0
  3. data/History +253 -0
  4. data/MIT-LICENSE +20 -0
  5. data/README.rdoc +54 -0
  6. data/Rakefile +13 -0
  7. data/bin/httparty +108 -0
  8. data/cucumber.yml +1 -0
  9. data/examples/aaws.rb +32 -0
  10. data/examples/basic.rb +32 -0
  11. data/examples/custom_parsers.rb +67 -0
  12. data/examples/delicious.rb +37 -0
  13. data/examples/google.rb +16 -0
  14. data/examples/rubyurl.rb +14 -0
  15. data/examples/tripit_sign_in.rb +33 -0
  16. data/examples/twitter.rb +31 -0
  17. data/examples/whoismyrep.rb +10 -0
  18. data/features/basic_authentication.feature +20 -0
  19. data/features/command_line.feature +7 -0
  20. data/features/deals_with_http_error_codes.feature +26 -0
  21. data/features/digest_authentication.feature +20 -0
  22. data/features/handles_compressed_responses.feature +19 -0
  23. data/features/handles_multiple_formats.feature +34 -0
  24. data/features/steps/env.rb +22 -0
  25. data/features/steps/httparty_response_steps.rb +26 -0
  26. data/features/steps/httparty_steps.rb +27 -0
  27. data/features/steps/mongrel_helper.rb +94 -0
  28. data/features/steps/remote_service_steps.rb +69 -0
  29. data/features/supports_redirection.feature +22 -0
  30. data/features/supports_timeout_option.feature +13 -0
  31. data/httparty.gemspec +31 -0
  32. data/lib/httparty.rb +455 -0
  33. data/lib/httparty/cookie_hash.rb +22 -0
  34. data/lib/httparty/core_extensions.rb +9 -0
  35. data/lib/httparty/exceptions.rb +26 -0
  36. data/lib/httparty/module_inheritable_attributes.rb +34 -0
  37. data/lib/httparty/net_digest_auth.rb +71 -0
  38. data/lib/httparty/parser.rb +140 -0
  39. data/lib/httparty/request.rb +252 -0
  40. data/lib/httparty/response.rb +85 -0
  41. data/lib/httparty/version.rb +3 -0
  42. data/spec/fixtures/delicious.xml +23 -0
  43. data/spec/fixtures/empty.xml +0 -0
  44. data/spec/fixtures/google.html +3 -0
  45. data/spec/fixtures/ssl/generate.sh +29 -0
  46. data/spec/fixtures/ssl/generated/1fe462c2.0 +16 -0
  47. data/spec/fixtures/ssl/generated/bogushost.crt +13 -0
  48. data/spec/fixtures/ssl/generated/ca.crt +16 -0
  49. data/spec/fixtures/ssl/generated/ca.key +15 -0
  50. data/spec/fixtures/ssl/generated/selfsigned.crt +14 -0
  51. data/spec/fixtures/ssl/generated/server.crt +13 -0
  52. data/spec/fixtures/ssl/generated/server.key +15 -0
  53. data/spec/fixtures/ssl/openssl-exts.cnf +9 -0
  54. data/spec/fixtures/twitter.json +1 -0
  55. data/spec/fixtures/twitter.xml +403 -0
  56. data/spec/fixtures/undefined_method_add_node_for_nil.xml +2 -0
  57. data/spec/httparty/cookie_hash_spec.rb +71 -0
  58. data/spec/httparty/net_digest_auth_spec.rb +93 -0
  59. data/spec/httparty/parser_spec.rb +155 -0
  60. data/spec/httparty/request_spec.rb +496 -0
  61. data/spec/httparty/response_spec.rb +193 -0
  62. data/spec/httparty/ssl_spec.rb +54 -0
  63. data/spec/httparty_spec.rb +621 -0
  64. data/spec/spec.opts +3 -0
  65. data/spec/spec_helper.rb +23 -0
  66. data/spec/support/ssl_test_helper.rb +25 -0
  67. data/spec/support/ssl_test_server.rb +69 -0
  68. data/spec/support/stub_response.rb +30 -0
  69. data/website/css/common.css +47 -0
  70. data/website/index.html +73 -0
  71. metadata +206 -0
@@ -0,0 +1,9 @@
1
+ Gemfile.lock
2
+ .DS_Store
3
+ .yardoc/
4
+ doc/
5
+ tmp/
6
+ log/
7
+ pkg/
8
+ *.swp
9
+ /.bundle
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source :rubygems
2
+ gemspec
3
+
4
+ group(:development) do
5
+ gem 'rake', '>= 0.8.7'
6
+ end
data/History ADDED
@@ -0,0 +1,253 @@
1
+ == 0.7.8 2011-06-06
2
+ * bug fix
3
+ * Make response honor respond to
4
+ * net http timeout can also be a float
5
+
6
+ == 0.7.7 2011-04-16
7
+ * bug fix
8
+ * Fix NoMethodError when using the NON_RAILS_QUERY_STRING_NORMALIZER with a hash whose key is a symbol and value is nil
9
+
10
+ == 0.7.5 2011-04-16
11
+ * bug fix
12
+ * caused issue with latest rubygems
13
+
14
+ == 0.7.4 2011-02-13
15
+ * bug fixes
16
+ * Set VERIFY_NONE when using https. Ruby 1.9.2 no longer sets this for us. gh-67
17
+
18
+ == 0.7.3 2011-01-20
19
+ * bug fixes
20
+ * Fix digest auth for unspecified quality of protection (bjoernalbers, mtrudel, dwo)
21
+
22
+ == 0.7.2 2011-01-20
23
+ * bug fixes
24
+ * Fix gem dependencies
25
+
26
+ == 0.7.1 2011-01-19
27
+ * bug fixes
28
+ * Fix uninitialized constant HTTParty::Response::Net in 1.9.2 (cap10morgan)
29
+ * Other fixes for 1.9.2, full suite still fails (cap10morgan)
30
+
31
+ == 0.7.0 2011-01-18
32
+ * minor enhancements
33
+ * Added query methods for HTTP status codes, i.e. response.success?
34
+ response.created? (thanks citizenparker)
35
+ * Added support for ssl_ca_file and ssl_ca_path (dlitz)
36
+ * Allow custom query string normalization. gh-8
37
+ * Unlock private keys with password (freerange)
38
+ * Added high level request documentation (phildarnowsky)
39
+ * Added basic post example (pbuckley)
40
+ * Response object has access to its corresponding request object
41
+ * Added example of siginin into tripit.com
42
+ * Added option to follow redirects (rkj). gh-56
43
+ * bug fixes
44
+ * Fixed superclass mismatch exception while running tests
45
+ (thanks dlitz http://github.com/dlitz/httparty/commit/48224f0615b32133afcff4718ad426df7a4b401b)
46
+
47
+ == 0.6.1 2010-07-07
48
+ * minor enhancements
49
+ * updated to crack 0.1.8
50
+ * bug fixes
51
+ * subclasses always merge into the parent's default_options and
52
+ default_cookies (l4rk).
53
+ * subclasses play nicely with grand parents. gh-49
54
+
55
+ == 0.6.0 2010-06-13
56
+ * major enhancements
57
+ * Digest Auth (bartiaco, sbecker, gilles, and aaronrussell)
58
+ * Maintain HTTP method across redirects (bartiaco and sbecker)
59
+ * HTTParty::Response#response returns the Net::HTTPResponse object
60
+ * HTTParty::Response#headers returns a HTTParty::Response::Headers object
61
+ which quacks like a Hash + Net::HTTPHeader. The #headers method continues
62
+ to be backwards-compatible with the old Hash return value but may become
63
+ deprecated in the future.
64
+
65
+ * minor enhancements
66
+ * Update crack requirement to version 0.1.7
67
+ You may still get a warning because Crack's version constant is out of date
68
+ * Timeout option can be set for all requests using HTTParty.default_timeout (taazza)
69
+ * Closed #38 "headers hash should downcase keys so canonical header name can be used"
70
+ * Closed #40 "Gzip response" wherein gziped and deflated responses are
71
+ automatically inflated. (carsonmcdonald)
72
+
73
+ == 0.5.2 2010-01-31
74
+ * minor enhancements
75
+ * Update crack requirement to version 0.1.6
76
+
77
+ == 0.5.1 2010-01-30
78
+ * bug fixes
79
+ * Handle 304 response correctly by returning the HTTParty::Response object instead of redirecting (seth and hellvinz)
80
+ * Only redirect 300 responses if the header contains a Location
81
+ * Don't append empty query strings to the uri. Closes #31
82
+ * When no_follow is enabled, only raise the RedirectionTooDeep exception when a response tries redirecting. Closes #28
83
+
84
+ * major enhancements
85
+ * Removed rubygems dependency. I suggest adding rubygems to RUBYOPT if this causes problems for you.
86
+ $ export RUBYOPT='rubygems'
87
+ * HTTParty#debug_output prints debugging information for the current request (iwarshak)
88
+ * HTTParty#no_follow now available as a class-level option. Sets whether or not to follow redirects.
89
+
90
+ * minor enhancements
91
+ * HTTParty::VERSION now available
92
+ * Update crack requirement to version 0.1.5
93
+
94
+ == 0.5.0 2009-12-07
95
+ * bug fixes
96
+ * inheritable attributes no longer mutable by subclasses (yyyc514)
97
+ * namespace BasicObject within HTTParty to avoid class name collisions (eric)
98
+
99
+ * major enhancements
100
+ * Custom Parsers via class or proc
101
+ * Deprecation warning on HTTParty::AllowedFormats
102
+ moved to HTTParty::Parser::SupportedFormats
103
+
104
+ * minor enhancements
105
+ * Curl inspired output when using the binary in verbose mode (alexvollmer)
106
+ * raise UnsupportedURIScheme when scheme is not HTTP or HTTPS (djspinmonkey)
107
+ * Allow SSL for ports other than 443 when scheme is HTTPS (stefankroes)
108
+ * Accept PEM certificates via HTTParty#pem (chrislo)
109
+ * Support HEAD and OPTION verbs (grempe)
110
+ * Verify SSL certificates when providing a PEM file (collectiveidea/danielmorrison)
111
+
112
+ == 0.4.5 2009-09-12
113
+ * bug fixes
114
+ * Fixed class-level headers overwritten by cookie management code. Closes #19
115
+ * Fixed "superclass mismatch for class BlankSlate" error. Closes #20
116
+ * Fixed reading files as post data from the command line (vesan)
117
+
118
+ * minor enhancements
119
+ * Timeout option added; will raise a Timeout::Error after the timeout has elapsed (attack). Closes #17
120
+ HTTParty.get "http://github.com", :timeout => 1
121
+ * Building gem with Jeweler
122
+
123
+ == 0.4.4 2009-07-19
124
+ * 2 minor update
125
+ * :query no longer sets form data. Use body and set content type to application/x-www-form-urlencoded if you need it. :query was wrong for that.
126
+ * Fixed a bug in the cookies class method that caused cookies to be forgotten after the first request.
127
+ * Also, some general cleanup of tests and such.
128
+
129
+ == 0.4.3 2009-04-23
130
+ * 1 minor update
131
+ * added message to the response object
132
+
133
+ == 0.4.2 2009-03-30
134
+ * 2 minor changes
135
+ * response code now returns an integer instead of a string (jqr)
136
+ * rubyforge project setup for crack so i'm now depending on that instead of jnunemaker-crack
137
+
138
+ == 0.4.1 2009-03-29
139
+ * 1 minor fix
140
+ * gem 'jnunemaker-crack' instead of gem 'crack'
141
+
142
+ == 0.4.0 2009-03-29
143
+ * 1 minor change
144
+ * Switched xml and json parsing to crack (same code as before just moved to gem for easier reuse in other projects)
145
+
146
+ == 0.3.1 2009-02-10
147
+ * 1 minor fix, 1 minor enhancement
148
+ * Fixed unescaping umlauts (siebertm)
149
+ * Added yaml response parsing (Miha Filej)
150
+
151
+ == 0.3.0 2009-01-31
152
+ * 1 major enhancement, 1 bug fix
153
+ * JSON gem no longer a requirement. It was conflicting with rails json stuff so I just stole ActiveSupport's json decoding and bundled it with HTTParty.
154
+ * Fixed bug where query strings were being duplicated on redirects
155
+ * Added a bunch of specs and moved some code around.
156
+
157
+ == 0.2.10 2009-01-29
158
+ * 1 minor enhancement
159
+ * Made encoding on query parameters treat everything except URI::PATTERN::UNRESERVED as UNSAFE to force encoding of '+' character (Julian Russell)
160
+
161
+ == 0.2.9 2009-01-29
162
+ * 3 minor enhancements
163
+ * Added a 'headers' accessor to the response with a hash of any HTTP headers. (Don Peterson)
164
+ * Add support for a ":cookies" option to be used at the class level, or as an option on any individual call. It should be passed a hash, which will be converted to the proper format and added to the request headers when the call is made. (Don Peterson)
165
+ * Refactored several specs and added a full suite of cucumber features (Don Peterson)
166
+
167
+ == 0.2.8 2009-01-28
168
+ * 1 major fix
169
+ * fixed major bug with response where it wouldn't iterate or really work at all with parsed responses
170
+
171
+ == 0.2.7 2009-01-28
172
+ * 2 minor fixes, 2 minor enhancements, 2 major enhancements
173
+ * fixed undefined method add_node for nil class error that occasionally happened (juliocesar)
174
+ * Handle nil or unexpected values better when typecasting. (Brian Landau)
175
+ * More robust handling of mime types (Alex Vollmer)
176
+ * Fixed support for specifying headers and added support for basic auth to CLI. (Alex Vollmer)
177
+ * Added first class response object that includes original body and status code (Alex Vollmer)
178
+ * Now parsing all response types as some non-200 responses provide important information, this means no more exception raising (Alex Vollmer)
179
+
180
+ == 0.2.6 2009-01-05
181
+ * 1 minor bug fix
182
+ * added explicit require of time as Time#parse failed outside of rails (willcodeforfoo)
183
+
184
+ == 0.2.5 2009-01-05
185
+ * 1 major enhancement
186
+ * Add command line interface to HTTParty (Alex Vollmer)
187
+
188
+ == 0.2.4 2008-12-23
189
+ * 1 bug fix
190
+ * Fixed that mimetype detection was failing if no mimetype was returned from service (skippy)
191
+ == 0.2.3 2008-12-23
192
+ * 1 bug fix
193
+ * Fixed typecasting class variable naming issue
194
+
195
+ == 0.2.2 2008-12-08
196
+ * 1 bug fix
197
+ * Added the missing core extension hash method to_xml_attributes
198
+
199
+ == 0.2.1 2008-12-08
200
+ * 1 bug fix
201
+ * Fixed that HTTParty was borking ActiveSupport and as such Rails (thanks to Rob Sanheim)
202
+
203
+ == 0.2.0 2008-12-07
204
+ * 1 major enhancement
205
+ * Removed ActiveSupport as a dependency. Now requires json gem for json deserialization and uses an included class to do the xml parsing.
206
+
207
+ == 0.1.8 2008-11-30
208
+ * 3 major enhancements
209
+ * Moved base_uri normalization into request class and out of httparty module, fixing
210
+ the problem where base_uri was not always being normalized.
211
+ * Stupid simple support for HTTParty.get/post/put/delete. (jqr)
212
+ * Switched gem management to Echoe from newgem.
213
+
214
+ == 0.1.7 2008-11-30
215
+ * 1 major enhancement
216
+ * fixed multiple class definitions overriding each others options
217
+
218
+ == 0.1.6 2008-11-26
219
+ * 1 major enhancement
220
+ * now passing :query to set_form_data if post request to avoid content length errors
221
+
222
+ == 0.1.5 2008-11-14
223
+ * 2 major enhancements
224
+ * Refactored send request method out into its own object.
225
+ * Added :html format if you just want to do that.
226
+
227
+ == 0.1.4 2008-11-08
228
+ * 3 major enhancements:
229
+ * Removed some cruft
230
+ * Added ability to follow redirects automatically and turn that off (Alex Vollmer)
231
+
232
+ == 0.1.3 2008-08-22
233
+
234
+ * 3 major enhancements:
235
+ * Added http_proxy key for setting proxy server and port (francxk@gmail.com)
236
+ * Now raises exception when http error occurs (francxk@gmail.com)
237
+ * Changed auto format detection from file extension to response content type (Jay Pignata)
238
+
239
+ == 0.1.2 2008-08-09
240
+
241
+ * 1 major enhancement:
242
+ * default_params were not being appended to query string if option[:query] was blank
243
+
244
+ == 0.1.1 2008-07-30
245
+
246
+ * 2 major enhancement:
247
+ * Added :basic_auth key for options when making a request
248
+ * :query and :body both now work with query string or hash
249
+
250
+ == 0.1.0 2008-07-27
251
+
252
+ * 1 major enhancement:
253
+ * Initial release
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 John Nunemaker
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,54 @@
1
+ = httparty
2
+
3
+ Makes http fun again!
4
+
5
+ == Note on Releases
6
+
7
+ Releases are tagged on github and also released as gems on github and rubyforge. Master is pushed to whenever I add a patch or a new feature. To build from master, you can clone the code, generate the updated gemspec, build the gem and install.
8
+
9
+ * rake gemspec
10
+ * gem build httparty.gemspec
11
+ * gem install the gem that was built
12
+
13
+ == Note on Patches/Pull Requests
14
+
15
+ * Fork the project.
16
+ * Make your feature addition or bug fix.
17
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
18
+ * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself in another branch so I can ignore when I pull)
19
+ * Send me a pull request. Bonus points for topic branches.
20
+
21
+ == Features:
22
+
23
+ * Easy get, post requests
24
+ * Basic http authentication
25
+ * Default request query string parameters (ie: for api keys that are needed on each request)
26
+ * Automatic parsing of JSON and XML into ruby hashes based on response content-type
27
+
28
+ == Examples
29
+
30
+ See http://github.com/jnunemaker/httparty/tree/master/examples
31
+
32
+ == Command Line Interface
33
+
34
+ httparty also includes the executable <tt>httparty</tt> which can be
35
+ used to query web services and examine the resulting output. By default
36
+ it will output the response as a pretty-printed Ruby object (useful for
37
+ grokking the structure of output). This can also be overridden to output
38
+ formatted XML or JSON. Execute <tt>httparty --help</tt> for all the
39
+ options. Below is an example of how easy it is.
40
+
41
+ httparty "http://twitter.com/statuses/public_timeline.json"
42
+
43
+ == Requirements
44
+
45
+ * Crack http://github.com/jnunemaker/crack/ - For XML and JSON parsing.
46
+ * You like to party!
47
+
48
+ == Install
49
+
50
+ * sudo gem install httparty
51
+
52
+ == Docs
53
+
54
+ http://rdoc.info/projects/jnunemaker/httparty
@@ -0,0 +1,13 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec) do |spec|
6
+ spec.pattern = FileList['spec/**/*_spec.rb']
7
+ spec.rspec_opts = ['--options', 'spec/spec.opts']
8
+ end
9
+
10
+ require 'cucumber/rake/task'
11
+ Cucumber::Rake::Task.new(:features)
12
+
13
+ task :default => [:spec, :features]
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "optparse"
4
+ require "pp"
5
+
6
+ $:.unshift(File.join(File.dirname(__FILE__), "/../lib"))
7
+ require "httparty"
8
+
9
+ opts = {
10
+ :action => :get,
11
+ :headers => {},
12
+ :verbose => false
13
+ }
14
+
15
+ OptionParser.new do |o|
16
+ o.banner = "USAGE: #{$0} [options] [url]"
17
+
18
+ o.on("-f",
19
+ "--format [FORMAT]",
20
+ "Output format to use instead of pretty-print ruby: " +
21
+ "plain, json or xml") do |f|
22
+ opts[:output_format] = f.downcase.to_sym
23
+ end
24
+
25
+ o.on("-a",
26
+ "--action [ACTION]",
27
+ "HTTP action: get (default), post, put, delete, head, or options") do |a|
28
+ opts[:action] = a.downcase.to_sym
29
+ end
30
+
31
+ o.on("-d",
32
+ "--data [BODY]",
33
+ "Data to put in request body (prefix with '@' for file)") do |d|
34
+ if d =~ /^@/
35
+ opts[:data] = open(d[1..-1]).read
36
+ else
37
+ opts[:data] = d
38
+ end
39
+ end
40
+
41
+ o.on("-H", "--header [NAME=VALUE]", "Additional HTTP headers in NAME=VALUE form") do |h|
42
+ abort "Invalid header specification, should be Name:Value" unless h =~ /.+:.+/
43
+ name, value = h.split(':')
44
+ opts[:headers][name.strip] = value.strip
45
+ end
46
+
47
+ o.on("-v", "--verbose", "If set, print verbose output") do |v|
48
+ opts[:verbose] = true
49
+ end
50
+
51
+ o.on("-u", "--user [CREDS]", "Use basic authentication. Value should be user:password") do |u|
52
+ abort "Invalid credentials format. Must be user:password" unless u =~ /.+:.+/
53
+ user, password = u.split(':')
54
+ opts[:basic_auth] = { :username => user, :password => password }
55
+ end
56
+
57
+ o.on("-h", "--help", "Show help documentation") do |h|
58
+ puts o
59
+ exit
60
+ end
61
+ end.parse!
62
+
63
+
64
+ if ARGV.empty?
65
+ STDERR.puts "You need to provide a URL"
66
+ STDERR.puts "USAGE: #{$0} [options] [url]"
67
+ end
68
+
69
+ def dump_headers(response)
70
+ resp_type = Net::HTTPResponse::CODE_TO_OBJ[response.code.to_s]
71
+ puts "#{response.code} #{resp_type.to_s.sub(/^Net::HTTP/, '')}"
72
+ response.headers.each do |n,v|
73
+ puts "#{n}: #{v}"
74
+ end
75
+ puts
76
+ end
77
+
78
+ if opts[:verbose]
79
+ puts "#{opts[:action].to_s.upcase} #{ARGV.first}"
80
+ opts[:headers].each do |n,v|
81
+ puts "#{n}: #{v}"
82
+ end
83
+ puts
84
+ end
85
+
86
+ response = HTTParty.send(opts[:action], ARGV.first, opts)
87
+ if opts[:output_format].nil?
88
+ dump_headers(response) if opts[:verbose]
89
+ pp response
90
+ else
91
+ print_format = opts[:output_format]
92
+ dump_headers(response) if opts[:verbose]
93
+
94
+ case opts[:output_format]
95
+ when :json
96
+ begin
97
+ require 'json'
98
+ puts JSON.pretty_generate(response.delegate)
99
+ rescue LoadError
100
+ puts YAML.dump(response.delegate)
101
+ end
102
+ when :xml
103
+ REXML::Document.new(response.body).write(STDOUT, 2)
104
+ puts
105
+ else
106
+ puts response
107
+ end
108
+ end