-
-
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(client): add capture_connection #3144
Conversation
a8b5029
to
60fa720
Compare
/// client.request(request).await.expect("request failed"); | ||
/// # } | ||
/// ``` | ||
pub fn capture_connection<B>(request: &mut crate::http::Request<B>) -> CaptureConnection { |
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.
Extension trait?
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.
discussed offline, will defer for now but could add later
@@ -115,6 +118,114 @@ pub struct Connected { | |||
pub(super) extra: Option<Extra>, | |||
} | |||
|
|||
/// [`CaptureConnection`] allows callers to capture [`Connected`] information |
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.
Does this need to live in this file or can we move it out?
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.
can definitely be moved—any preference for final location?
Add `capture_connection` functionality. This allows callers to retrieve the `Connected` struct of the connection that was used internally by Hyper. This is in service of hyperium#2605. Although this uses `http::Extensions` under the hood, the API exposed explicitly hides that detail.
60fa720
to
d3c9b6a
Compare
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.
Looks real clear to me, love it!
) Add `capture_connection` functionality. This allows callers to retrieve the `Connected` struct of the connection that was used internally by Hyper. This is in service of hyperium#2605. Although this uses `http::Extensions` under the hood, the API exposed explicitly hides that detail.
Add
capture_connection
functionality. This allows callers to retrieve theConnected
struct of the connection that was used internally by Hyper. This is in service of #2605.This pairs with a coming PR that adds a
poison
API toConnected
— the pair of these APIs makes it possible to avoid reusing connections that the client deems to be bad.Example usage:
Although this uses
http::Extensions
under the hood, the API exposed explicitly hides that detail.