lib/pact/provider/pact_uri.rb in pact-1.10.0 vs lib/pact/provider/pact_uri.rb in pact-1.11.0
- old
+ new
@@ -12,16 +12,27 @@
other.is_a?(PactURI) &&
uri == other.uri &&
options == other.options
end
+ def basic_auth?
+ !!username
+ end
+
+ def username
+ options[:username]
+ end
+
+ def password
+ options[:password]
+ end
+
def to_s
- if(options[:username])
- URI(@uri).tap { |x| x.userinfo="#{options[:username]}:*****"}.to_s
+ if(basic_auth?)
+ URI(@uri).tap { |x| x.userinfo="#{username}:*****"}.to_s
else
@uri
end
-
end
end
end
-end
\ No newline at end of file
+end