openid icon indicating copy to clipboard operation
openid copied to clipboard

feat: support reqwest-middleware

Open rbtcollins opened this issue 1 year ago • 2 comments

This would allow adding caching, otel etc without needing more changes to the openid crate. One pattern I quite like is to define a trait that specifies only what you actually use from reqwest, and then users can implement that themselves as needed.

rbtcollins avatar Apr 11 '24 12:04 rbtcollins

~~If it could be implemented with feature guard, I am not against it~~. Oops, I understood, that this will allow to change behavior, which we should not allow.

It would be interesting to know, why original reqwest does not have it?

One thing we can probably have is to have tracing feature to add tracing crate integration.

kilork avatar Apr 12 '24 04:04 kilork

Oops, I understood, that this will allow to change behavior, which we should not allow.

I'm not sure what you mean here, since if someone really wants to change behaviour they can just replace the entire reqwest crate dependency you have with a custom implementation. In terms of spec compliance, having middleware on an HTTP client is perhaps a risk, but a fairly small one.

I can't answer why reqwest itself doesn't support middleware, but it doesn't, so there is that.

rbtcollins avatar Apr 12 '24 11:04 rbtcollins