First class middleware support
Author: ranger-rossCreated May 16, 2025Updated Sep 9, 2026
A fairly common usecase for http clients is to have some common logic that runs before or after the request. (logging a request/response being a frequent example)
Currently we have reqwest-middleware as a third party crate that works fairly well. However reqwest-middlewares comes with some downsides:
- You are expected to interact with the reqwest client through reqwest-middleware's
ClientWithMiddlewarewhich can make it difficult/not possible to use with code that expects reqwestClient. - Version compatibility between reqwest and reqwest-middleware is not obvious and upgrading may require multiple libraries to be crates in step to work.
- reqwest-middleware does not support blocking clients (see https://github.com/TrueLayer/reqwest-middleware/issues/32)
These pain points would go away if reqwest had first class middleware support and perhaps align with #2585 ?
I'd be happy to help contribute towards this if we can find an agreed upon solution
Related discussions/issues
- #155
Source: seanmonstar/reqwest