Replies: 1 comment 1 reply
-
|
There currently isn't a way that I can see. Well, I suppose you could keep a clone of the client, and use it to prepare a request, and then call It could be possible if we followed the suggestions a couple people have made to completely disconnect the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
For a project I've a
tower::Serviceandtower::Layerthat modifies the body of any request in such a way thatThe reason for doing this isn't very important, the
PendingWrapperonly wrapsPendingand returns an err if the service failed.I have a trivial implementation of
WrapperServiceLayerthat just takes thereqwest::Clientas inner and creates aWrapperService.Then, I create a client like this:
The problem is that now to use client I have to do
client.call(req).awaitwhere I need to manually create thereqwest::Requestand I lose all the ergonomics fromreqwest::Clientwhere I could doclient.post(url).header(...)....and so on.It's not so bad, but before going down this road I wanted to see if there was an alternative I didn't know about where I could keep the ergonomics from
reqwest::Client/reqwest::RequestBuilderand have a service that intercept and modifies the body of every request.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions