Method: Pact::Provider::PactURI#to_s

Defined in:
lib/pact/provider/pact_uri.rb

#to_sObject



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/pact/provider/pact_uri.rb', line 31

def to_s
  if basic_auth? && http_or_https_uri?
    begin
      URI(@uri).tap { |x| x.userinfo="#{username}:*****"}.to_s
    rescue URI::InvalidComponentError
      URI(@uri).tap { |x| x.userinfo="*****:*****"}.to_s
    end
  elsif personal_access_token? && http_or_https_uri?
    URI(@uri).tap { |x| x.userinfo="*****"}.to_s
  else
    uri
  end
end