-
-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: #184 Escape username before asigning it to URI userinfo attribute
- Loading branch information
Samuel McKendrick
committed
Jan 26, 2018
1 parent
8e45062
commit 81bb779
Showing
2 changed files
with
20 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,10 +175,7 @@ module Domain | |
end | ||
end | ||
|
||
context "when a username and password are specified" do | ||
|
||
let(:username) { 'username' } | ||
let(:password) { 'password' } | ||
describe "when a username and password are specified" do | ||
|
||
let!(:http_request_with_basic_auth) do | ||
stub_request(:post, "http://example.org/hook"). | ||
|
@@ -189,9 +186,24 @@ module Domain | |
to_return(:status => 200, :body => "respbod", :headers => {'Content-Type' => 'text/foo, blah'}) | ||
end | ||
|
||
it "uses the credentials" do | ||
subject.execute(pact, options) | ||
expect(http_request_with_basic_auth).to have_been_made | ||
context "with normal characters" do | ||
let(:username) { "username" } | ||
let(:password) { "password" } | ||
|
||
it "uses the credentials" do | ||
subject.execute(pact, options) | ||
expect(http_request_with_basic_auth).to have_been_made | ||
end | ||
end | ||
|
||
context "with special characters" do | ||
let(:username) { "[email protected]" } | ||
let(:password) { "p@$$w0rd!" } | ||
|
||
it "uses the credentials" do | ||
subject.execute(pact, options) | ||
expect(http_request_with_basic_auth).to have_been_made | ||
end | ||
end | ||
end | ||
|
||
|