Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Turn $DEBUG on CLI execution

  • Loading branch information...
commit e920a5fdc8ceb92f8b8d6910ea54b9e8232a7ae9 1 parent cd8653e
@nahi authored
Showing with 9 additions and 3 deletions.
  1. +1 −1  README.txt
  2. +8 −2 bin/httpclient
View
2  README.txt
@@ -33,7 +33,7 @@ See HTTPClient for documentation.
== httpclient command
Usage: 1) % httpclient get https://www.google.co.jp/ q=ruby
-Usage: 2) %httpclient
+Usage: 2) % httpclient
For 1) it issues a GET request to the given URI and shows the wiredump and
the parsed result. For 2) it invokes irb shell with the binding that has a
View
10 bin/httpclient
@@ -3,7 +3,7 @@
# httpclient shell command.
#
# Usage: 1) % httpclient get https://www.google.co.jp/ q=ruby
-# Usage: 2) %httpclient
+# Usage: 2) % httpclient
#
# For 1) it issues a GET request to the given URI and shows the wiredump and
# the parsed result. For 2) it invokes irb shell with the binding that has a
@@ -15,6 +15,7 @@ METHODS = ['head', 'get', 'post', 'put', 'delete', 'options', 'propfind', 'propp
if ARGV.size >= 2 && METHODS.include?(ARGV[0])
client = HTTPClient.new
client.debug_dev = STDERR
+ $DEBUG = true
require 'pp'
pp client.send(*ARGV)
exit
@@ -29,7 +30,12 @@ class Runner
end
def method_missing(msg, *a, &b)
- @httpclient.send(msg, *a, &b)
+ debug, $DEBUG = $DEBUG, true
+ begin
+ @httpclient.send(msg, *a, &b)
+ ensure
+ $DEBUG = debug
+ end
end
def run

0 comments on commit e920a5f

Please sign in to comment.
Something went wrong with that request. Please try again.