-
Notifications
You must be signed in to change notification settings - Fork 236
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(transport-http): layer client #1227
Conversation
The |
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.
cool, this should work.
I'd like to see some more advanced tests/exampls here that make use of some tower-http components
for example auth
What we currently have working is the following:
TODO
|
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.
nits
overall this looks good
I think we could just use something like |
This makes sense! |
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.
nits
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.
lgtm
* feat(transport): bare minimal reqwest-tower integration * feat(transport-http): reqwest-tower layer client * feat(transport-http): LayerClient * fix: feature gate layer transport * rm logging layer * feat(transport-http): hyper layer transport * hyper layer transport test * test with tower-http layers * rm reqwest layer transport * rm trait bounds for new * nit * unify hyper transports * rm TransportConnect for HyperLayerTransport * make request generic * unify hyper transports * nit * nit * nit * rm unintended reqwest default * rename HyperLayerTransport to HyperTransport * rename file * nit * fix: rm transport from HttpConnect * fix: rm url from HyperTransport, infer it from Http * clippy * fix * impl Http<Hyper> * fix * rename * nit
Motivation
Currently, there is no way to modify the absolute low-level request such as
http::Request
.This is due to the limitation that
transport
layers work overalloy_json_rpc::RequestPacket
and nothttp::Request
.Solution
Making the
hyper
transport HTTP client generic over an underlying service.By default, it serves as a vanilla hyper client like before (use
HyperTransport::new()
), with the added benefit of adding tower layers on top of thehyper::Client
and using that inHyperTransport::with_service(service)
.This new set of layers will work over
http::Request
which is used byhyper
allowing us to modify request properties such as headers.A
HyperTransport
with layers can be initialized like so:This will help implement a JWT auth layer #1161 that refreshes auth tokens.
PR Checklist