lib/webmock/webmock.rb in webmock-1.24.2 vs lib/webmock/webmock.rb in webmock-1.24.3
- old
+ new
@@ -66,13 +66,17 @@
def self.net_connect_explicit_allowed?(allowed, uri=nil)
case allowed
when Array
allowed.any? { |allowed_item| net_connect_explicit_allowed?(allowed_item, uri) }
when Regexp
- uri.to_s =~ allowed
+ uri.to_s =~ allowed ||
+ uri.omit(:port).to_s =~ allowed && uri.port == uri.default_port
when String
+ allowed == uri.to_s ||
allowed == uri.host ||
- allowed == "#{uri.host}:#{uri.port}"
+ allowed == "#{uri.host}:#{uri.port}" ||
+ allowed == "#{uri.scheme}://#{uri.host}:#{uri.port}" ||
+ allowed == "#{uri.scheme}://#{uri.host}" && uri.port == uri.default_port
else
if allowed.respond_to?(:call)
allowed.call(uri)
end
end