Move to explicit method call for Basic Auth credentials in push client #242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While URLs do support passing Basic Auth credentials using the
http://user:[email protected]/syntax, the username and password inthat syntax have to follow the usual rules for URL encoding of
characters per RFC 3986
(https://datatracker.ietf.org/doc/html/rfc3986#section-2.1).
Rather than place the burden of correctly performing that encoding on
users of this gem, we decided to have a separate method for supplying
Basic Auth credentials, with no requirement to URL encode the characters
in them.
Since the tests around HTTP requests are extremely heavily mocked, I tested this locally with a real pushgateway configured with one user with
@in the password and another with:in it, as well as a more boring password that only used basic latin alphabet characters. All three worked.Maybe at some point we should have some integration tests, but that feels like its own piece of work.
Fixes #170