-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add context::Builder #24
base: master
Are you sure you want to change the base?
Conversation
lib/src/context/builder.rs
Outdated
} | ||
|
||
/// Set an header | ||
pub fn set_header<H: Header>(mut self, value: H) -> Self { |
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.
Methods on a builder should be just header
and not set_header
. See a similar method on http::request::Builder
: https://docs.rs/http/0.1.0/http/request/struct.Builder.html#method.header
lib/src/context/builder.rs
Outdated
} | ||
|
||
/// Set the request data | ||
pub fn set_data<B: Into<Body>>(mut self, body: B) -> Self { |
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.
Same comment as set_header
.
lib/src/request/builder.rs
Outdated
} | ||
|
||
/// Create the `Context`, returning any error that occurs during build. | ||
pub fn finalize(self) -> Result<Request, error::UriError> { |
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.
This should probably be Result<Request, shio::Error>
so we don't expose the hyper
error type.
Awesome job again and appreciate the fixes @Meralis40. Really busy this week so not sure when I'll have time to wrap this up. |
Add
context::Builder
, a helper struct for creating aContext
.Also modify
Router
tests to use the newBuilder
.Closes #22