-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Introduce Request type and refactor execution flow. #103
Conversation
@theduke I'm actually going to bring this up during the reqwest lib blitz meeting (Tuesday), as the API design is already a point of discussion in there. |
I commented in #85 about this. |
This should be pretty much ready now, @seanmonstar. Let me know if you need any changes. |
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.
I think this looks excellent!
Of course, the changes to the builder will mean that build()
shouldn't actually error (all errors will be returned while configuring, instead of stored like now), but that's details for a builder PR.
src/client.rs
Outdated
} | ||
|
||
/// Takes the body, leaving None in it's place. | ||
pub fn take_body(&mut self) -> Option<Body> { |
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.
If this is rather useful, then perhaps it and the setter should be combined into a single body_mut(&mut self) -> &mut Option<Body>
?
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.
Not sure if it's neccessary, but we might as well add a way to do it. Someone will need it eventually.
I wasn't so sure about it, but I went for take_
now because it seemed weird to work with &mut Option<_>.
I'm not invested in either variant, though. I you prefer body_mut, I'll change it quickly.
A Request can be obtained with RequestBuilder::build(), and executed with Client::execute(). The RequestBuilder now also builds a Request and forwards it to the inner client. The execution logic was moved from Requestbuilder::send() to ClientRef::execute_request().
Merged via e9f464a Thanks for pushing on this! |
This PR introduces a Request type that represents a
ready to execute request.
A Request can be obtained with RequestBuilder::build(), and executed
with Client::execute().
The RequestBuilder now also builds a Request and forwards it to the
inner client.
The execution logic was moved from Requestbuilder::send() to
ClientRef::execute_request().