Skip to content

Commit

Permalink
Fixed additional cases to accept uris with non-utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
bblimke committed Sep 27, 2013
1 parent b9b4f36 commit 7525777
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/webmock/util/uri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,17 @@ def self.uris_encoded_and_unencoded(uris)
end

def self.uris_with_scheme_and_without(uris)
uris.map { |uri| [ uri, uri.gsub(%r{^https?://},"").freeze ] }.flatten
uris.map { |uri|
uri = uri.dup.force_encoding(Encoding::ASCII_8BIT) if uri.respond_to?(:force_encoding)
[ uri, uri.gsub(%r{^https?://},"").freeze ]
}.flatten
end

def self.uris_with_trailing_slash_and_without(uris)
uris = uris.map { |uri| [ uri, uri.omit(:path).freeze ] }.flatten
uris = uris.map { |uri|
uri = uri.dup.force_encoding(Encoding::ASCII_8BIT) if uri.respond_to?(:force_encoding)
[ uri, uri.omit(:path).freeze ]
}.flatten
end

end
Expand Down

0 comments on commit 7525777

Please sign in to comment.