reqwest-middleware/reqwest-retry
Rutger 594075583c
Added a way to specify custom functions which decide whether a request should be retried or not (#33)
* Add a generic function to the middleware struct for the `Retryable` decision.

The generic function can be used to define custom behaviour to decide whether to retry a request or not.

By default, this function is `Retryable::from_reqwest_response` which is the same as it was before.

* Add a way to create custom retry policies.

A RetryStrategy will dictate what decision will be made based on the result of the sent request.

* Add RetryableStrategy in the `RetryTransientMiddleware` struct instead of the seperate functions

* Add constructor to create a `RetryTransientMiddleware` with a custom `RetryableStrategy`

* Run `cargo fmt`

* Add example code to the `RetryableStrategy` struct

* Run `cargo fmt`

* Updated changelog

* use a trait

* docs

* include latest changes

Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
2023-05-22 11:53:31 +01:00
..
src Added a way to specify custom functions which decide whether a request should be retried or not (#33) 2023-05-22 11:53:31 +01:00
tests/all fix: remove middleware retry limit (#87) 2023-04-17 13:02:13 +01:00
.gitignore Initial commit 2021-08-13 08:59:58 +01:00
CHANGELOG.md Added a way to specify custom functions which decide whether a request should be retried or not (#33) 2023-05-22 11:53:31 +01:00
Cargo.toml release middleware 2023-05-11 14:17:05 +01:00
README.md Include README in crate doctests and improve documentation (#8) 2021-09-28 19:26:03 +01:00

README.md

reqwest-retry

Retry middleware implementation for reqwest-middleware.

Crates.io Docs.rs CI Coverage Status

Overview

Build RetryTransientMiddleware from a RetryPolicy, then attach it to a reqwest_middleware::ClientBuilder. retry-policies::policies is reexported under reqwest_retry::policies for convenience.

See reqwest_middleware for usage with reqwest.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.