Skip to content

Instantly share code, notes, and snippets.

@wtnabe
Created November 28, 2008 03:33
Show Gist options
  • Select an option

  • Save wtnabe/29892 to your computer and use it in GitHub Desktop.

Select an option

Save wtnabe/29892 to your computer and use it in GitHub Desktop.
A rest-client's patch for zero byte response body. Now no longer required.
index 1bf1d10..3716dee 100644
--- a/lib/rest_client.rb
+++ b/lib/rest_client.rb
@@ -228,7 +228,7 @@ module RestClient
end
def response_log(res)
- "# => #{res.code} #{res.class.to_s.gsub(/^Net::HTTP/, '')} | #{(res['Content-type'] || '').gsub(/;.*$/, '')} #{res.body.size} bytes"
+ "# => #{res.code} #{res.class.to_s.gsub(/^Net::HTTP/, '')} | #{(res['Content-type'] || '').gsub(/;.*$/, '')} #{res.body ? res.body.size : 0} bytes"
end
def display_log(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment