Support Retry-After header
According to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After:
When sent with a redirect response, such as 301 (Moved Permanently), this indicates the minimum time that the user agent is asked to wait before issuing the redirected request.
I tried to find some already existing related issues and checked sources, but seems like this header was mentioned before HTTP 429 (#169) context. Does it make any sense, to implement this direct in reqwest?
I think of scenario, in which this feature can be quite useful. Some REST interfaces use 429 to indicate long running job (which is not actually a rate-limit case).
Scenario: User wants to generate and download report on server. To do this he triggers POST /report/generate, which in its turn redirects to GET /download/:id.
But because generate process is long - /report/generate redirects to /poll/:id which replies with 429 and client continues to /poll/:id until it returns redirect to /download/:id.
curl currently supports Retry-After in 429. So it is possible for user to receive generated report with just one command invocation. Same can be achieved with wget (which does not respect Retry-After, but can be asked to retry some http codes). It would be nice to have this in reqwest too.
Source: seanmonstar/reqwest