Created
January 15, 2021 04:38
-
-
Save sfgeorge/858f83761d6efb22e41ef58c053e4110 to your computer and use it in GitHub Desktop.
exhibit a bug showing that the RestClient::RawResponse#body method doesn't exist in v2.0.2. This was fixed in v2.1.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
# gem 'rest-client', '= 2.1.0' | |
gem 'rest-client', '= 2.0.2' | |
end | |
def run | |
puts "The rest-client gem is at version #{RestClient::VERSION}" | |
url = 'https://github.com/404' | |
log_404(url: url, raw: false) | |
log_404(url: url, raw: true) | |
end | |
def log_404(url:, raw:) | |
options = { | |
:method => :get, | |
:url => url, | |
:raw_response => raw | |
} | |
begin | |
RestClient::Request.execute options | |
rescue StandardError => e | |
puts "Error Class: #{e.class} Error Body:" | |
puts e.http_body if e.respond_to?(:http_body) | |
end | |
end | |
run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment