Created
February 2, 2017 19:58
-
-
Save english/0fcdaa9be05c88e35feb4ed8197ba07e to your computer and use it in GitHub Desktop.
Reproduction of "ArgumentError: invalid byte sequence in UTF-8" webmock bug
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
#!/usr/bin/env ruby | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'webmock', '1.24.6' | |
end | |
include WebMock::API | |
stub_http_request(:get, /foo/).to_return(body: "abc") | |
begin | |
Net::HTTP.start("example.com", 9000, use_ssl: true) do |http| | |
request = Net::HTTP::Get.new('/foo') | |
request['Authorization'] = 'Basic foo' | |
http.request(request) | |
end | |
rescue => e | |
puts "ruby: #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} failed: #{e.inspect}" | |
else | |
puts "ruby: #{RUBY_VERSION}-p#{RUBY_PATCHLEVEL} passed" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running the above across various Ruby (MRI) versions:
The full backtrace for the above exceptions look like: