reqwest-middleware icon indicating copy to clipboard operation
reqwest-middleware copied to clipboard

Middleware wrappers for reqwest::Response

Open adensur opened this issue 2 years ago • 1 comments

There is currently no wrapper for reqwest::Response. As a result, resp.body().await? call is not retried. In the case where the response is large, resp.body() call involves a lot of tcp socket listening and can potentially throw network errors

adensur avatar Aug 31 '22 12:08 adensur

From what I understand about this issue, you want to be able to retry the response body? As far as I'm aware, it's not possible to do so without making a full new request again.

This would require the Response to carry around the Client and Request structs with it. I'm not sure if I like that being a default behaviour.

Perhaps I could interest you in https://docs.rs/futures-retry-policies/0.2.2/futures_retry_policies/ instead? It's a library I made using the same RetryPolicy types in order to retry arbitrary async functions

conradludgate avatar Nov 23 '22 11:11 conradludgate