Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created June 12, 2012 15:24
Show Gist options
  • Save myronmarston/2918173 to your computer and use it in GitHub Desktop.
Save myronmarston/2918173 to your computer and use it in GitHub Desktop.
require 'net/http'
response = Net::HTTP.start("httpstat.us") { |http| http.get("/204") }
puts "Body is: #{response.body.inspect}"
➜ ruby nil_response_body.rb
Body is: nil
➜ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin10.0]
➜ ruby nil_response_body.rb
Body is: nil
➜ rvm use 1.9.2
Using /Users/myron/.rvm/gems/ruby-1.9.2-p290
➜ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
➜ ruby nil_response_body.rb
Body is: nil
➜ rvm use 1.9.3
Using /Users/myron/.rvm/gems/ruby-1.9.3-p194
➜ ruby --version
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin10.8.0]
➜ ruby nil_response_body.rb
Body is: nil
➜ rvm use jruby
Using /Users/myron/.rvm/gems/jruby-1.6.7.2
➜ ruby --version
jruby 1.6.7.2 (ruby-1.8.7-p357) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java]
➜ ruby nil_response_body.rb
Body is: nil
➜ rvm use rbx
Using /Users/myron/.rvm/gems/rbx-head
➜ ruby --version
rubinius 2.0.0dev (1.8.7 66191c9f yyyy-mm-dd JI) [x86_64-apple-darwin10.8.0]
➜ ruby nil_response_body.rb
Body is: nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment