We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 03033f9 commit f6a0b4dCopy full SHA for f6a0b4d
lib/pact/provider/pact_uri.rb
@@ -29,10 +29,10 @@ def password
29
end
30
31
def to_s
32
- if(basic_auth?)
+ if basic_auth? && uri.start_with?('http://', 'https://')
33
URI(@uri).tap { |x| x.userinfo="#{username}:*****"}.to_s
34
else
35
- @uri
+ uri
36
37
38
spec/lib/pact/provider/pact_uri_spec.rb
@@ -30,6 +30,14 @@
it 'should include user name and password' do
expect(pact_uri.to_s).to eq('http://pact:*****@uri')
+
+ context 'when basic auth credentials have been set for a local file (eg. via environment variables, unintentionally)' do
+ let(:uri) { '/some/file thing.json' }
+ it 'does not blow up' do
+ expect(pact_uri.to_s).to eq uri
39
+ end
40
41
42
43
context 'without userinfo' do
0 commit comments