-
Notifications
You must be signed in to change notification settings - Fork 83
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
Many header types are missing public constructors #48
Comments
Any missing constructors is due to not having spent the time to design one. Ideally the typed headers don't expose their internals, and a constructor validates that the type is correct. Would you like to help design constructor for those types? |
I think I understand the motivation then, and it makes some sense to me. Although it was a bit confusing to see so many header types "available" that I couldn't actually use. I will probably hold off on integrating something like this into Rocket until more constructors are implemented or I can gauge how many of which categories of headers are already usable.
I'm definitely interested in doing so, but anything like a PR or code proposal might be a little while away. If anyone else is interested in doing them sooner than I can, please feel free! |
As far as I know, all URI characters should be valid Header value characters, so we can have an infallible constructor for Location from an `Uri`. This doesn't cover all uses of the Location header, since it allows URI-references like `/People.html#tim`, but it's an ergonomic win already, as mentioned in hyperium#48
Per rwf2/Rocket#1067 I looked into reexporting typed headers from this crate, as they were reexported from hyper 0.10 in the past. But I quickly discovered that many headers apparently can't be constructed, because they have a single private field and nothing like a
new
orfrom
method.In particular I was trying to use
Location
andETag
, but given #40 and after looking at the docs it looks like many other header types don't have public constructors either. Am I misunderstanding the purpose of this crate or misreading a trait bound, or are these simply missing constructors that need to be implemented?The text was updated successfully, but these errors were encountered: