Crate reqwest_retry_after
source ·Expand description
reqwest-retry-after
reqwest-retry-after
is a library that adds support for the Retry-After
header
in reqwest
, using reqwest_middleware
.
Usage
Simply pass RetryAfterMiddleware
to the [ClientWithMiddleware
] builder.
use reqwest_middleware::{ClientBuilder, ClientWithMiddleware};
use reqwest_retry_after::RetryAfterMiddleware;
let client = ClientBuilder::new(reqwest::Client::new())
.with(RetryAfterMiddleware::new())
.build();
Notes
A client constructed with RetryAfterMiddleware
will apply the Retry-After
header
to all future requests, regardless of domain or URL. This means that if you query one URL
which sets a Retry-After
, and then query a different URL that has no ratelimiting,
the Retry-After
will be applied to the new URL.
If you need this functionality, consider creating a seperate client for each endpoint.