-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
username() -> Option<&str>? #234
Comments
This reflects the data model in the spec: https://url.spec.whatwg.org/#urls
To be honest I don’t know the reason for this difference. @annevk, can you say more? If the username could also be null, I suppose it would be null in |
Some experiments:
This makes it impossible to specify the empty string as a username, as the application will always think, there was no username given at all. |
You can differentiate between password being present and not, but not with username. |
@annevk yes, in the model as currently specified in https://url.spec.whatwg.org/#urls. But is there a specific reason it is specified that way? |
As far as I know that matches user agents and how the syntax works. |
In fact the standard went in the opposite direction: removing the distinction between no password and an empty password whatwg/url#186 |
@SimonSapin Would that indicate then that password should also not be
With the current focus on ergonomics in the community I think it would be a nice addition. |
Hey, just wondering why username() returns an empty string and password() returns None if not set.
This makes my code a little weird:
If there isn't a good reason for this, I'd like to propose that
username()
should also return an Option.The text was updated successfully, but these errors were encountered: