-
Notifications
You must be signed in to change notification settings - Fork 24
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
fields.get returning an option for not found #82
Comments
I don't think the interface should return I am open to adding |
There is a difference between |
I was not aware that HTTP headers could be present without a value assigned - can you point me to an RFC where that is described? |
From RFC9110, sec. 5.5:
From RFC5234, sec. 3.6:
i.e. HTTP field values can contain zero characters. Most notably,
|
Thanks! We should make this change. We also need a way for setters to make a field present with no values. |
What if |
For some prior art, whatwg fetch uses the empty string to represent a present but empty header. See the second example here: https://fetch.spec.whatwg.org/#example-header-list-get-decode-split |
@pchickey the whatwg implementation also uses strings not lists for multiple values afaict - |
I think that's fine, and even required to represent a case when a key has multiple values, one of which is empty (e.g. However, returning |
Currently
fields.get
returns an empty list for a header that has no entry.It might be useful to explicitly make this an option?
Alternatively, a
fields.has
might be useful for these kinds of checks as well.A length check on a list for existence just feels a bit unintuitive even though it's semantically correct.
The text was updated successfully, but these errors were encountered: