Skip to content

Warn and strip userinfo if present in url#540

Open
sabiwara wants to merge 1 commit into
wojtekmach:mainfrom
sabiwara:warn-basic-auth
Open

Warn and strip userinfo if present in url#540
sabiwara wants to merge 1 commit into
wojtekmach:mainfrom
sabiwara:warn-basic-auth

Conversation

@sabiwara
Copy link
Copy Markdown
Contributor

Currently, when an URL with a userinfo like Req.get!("https://foo:bar@httpbin.org/basic-auth/foo/bar") is provided, Req silently ignores the userinfo, which makes it non-obvious why the request returns a 401:

It is especially confusing since req.url is still showed with the userinfo, and it can take some time to figure out when migrating an existing project from a library that used to handle the userinfo.

This PR adds a warning to shorten the feedback loop and provide actionable steps to address the issue.
We could probably be raising here, I went with a warning to be more conservative and kept the existing behavior - happy to update the strategy if we want to handle it differently.

Screenshot 2026-04-25 at 17 03 51

@jswanner
Copy link
Copy Markdown
Contributor

While I agree that Req shouldn't silently ignore userinfo in a URL, but since Req is "batteries-included" I'd more expect it to "just work" instead of warn, IMHO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants