-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(header): add prefer and preference applied headers #750
Conversation
Oh wow, this is extensive. Thanks for being thorough! I was wondering in the issue #747 whether many people use this, because I was wondering if it should be part of hyper, or if the implementation can live in your own crate. |
After a quick Google search, I found Microsoft Azure uses it (here is there specific extensions). Of course, as I mentioned in #747 the popular (~6,500 stars) PostgREST REST API uses it. And a few other links of people using it that my Google search turned up: |
On another note, I'm not sure why the test is failing, could you shed some light on that? |
@calebmer seems the error was an intermittent. I restarted the build. I've also asked on IRC for some others to put feedback, as I have no experience with this header :) |
fn from_str(s: &str) -> Result<Preference, Option<<u32 as FromStr>::Err>> { | ||
use self::Preference::*; | ||
let mut params = s.split(';').map(|p| { | ||
let mut param: Vec<_> = p.splitn(2, '=').collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use the split iterator instead of allocating this temporary vector. It'd change the match to match (params.next(), params.next())
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, and bump the indent for this closure please!
@calebmer I'll merge this after comments are addressed. Thanks again for such a thorough job. |
Sorry about the indentation, my editor is set to two spaces and looks for an Comments addressed 😊👍 |
Excellent! Thank you! |
Closes #747
The specification can be found here.