Repository navigation
URL.copy_with() drops the other credential when only username or password is given #3839
Unanswered
saanvimundra
asked this question in
Potential Issue
Replies: 1 comment
|
Related... encode/hip#122
It might be worth tackling the "deprecate URL username/password support in hip" issue instead, as a more focused use of time? |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
If a URL has both a username and a password,
URL.copy_with()with only one of them drops the other. It does not raise.I expected the first to keep
userand the second to keeppass. Only passing both works. Tested on httpx 0.28.1.The cause looks like
httpx/_urlparse.pyaround lines 244 to 248. When eitherusernameorpasswordis inkwargs,userinfois rebuilt from both, using an empty string for the one that was not passed, so the existing value is lost.I have a small fix in
URL.copy_withwith a regression test, and I can open a PR if that would be welcome.All reactions