kilork / openid

OpenID Connect Rust Library
The Unlicense
63 stars 22 forks source link

feat: support reqwest-middleware #50

Open rbtcollins opened 5 months ago

rbtcollins commented 5 months ago

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.

kilork commented 5 months ago

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.

rbtcollins commented 5 months ago

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.