Closed drahnr closed 1 month ago
FWIW, when I added pre_hook_async
it was also for signing requests in a similar manner, and as such already gets a mutable reference to the request.
FWIW, when I added
pre_hook_async
it was also for signing requests in a similar manner, and as such already gets a mutable reference to the request.
I'd be in favor to closing this PR and changing the sync hook API to take a &mut Request
.
Currently
progenitor
supportspre_hook
,pre_hook_async
andpost_hook
, where the further get a&reqwest::Request
passed. The auth mechanism for anOpenAPI
spec requires to sign the encoded query and append two key value pairs to the request, as such thepre-hook
appears to be the right place to adjust theRequest
accordingly.Proposal:
Add
with_pre_hook_mut
in addition, allowing to modify theRequest
accordingly.Considerations:
Since it's a per-request signature, modifying the
Client
itself is not sufficient.Altneratives:
Change the API of the current
pre_hook
to take a&mut
and use lint exception to avoid getting warnings on existing code.