Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: configure middleware for the internal POST calls #25

Open
Kah0ona opened this issue Feb 1, 2019 · 2 comments
Open

Enhancement: configure middleware for the internal POST calls #25

Kah0ona opened this issue Feb 1, 2019 · 2 comments

Comments

@Kah0ona
Copy link
Contributor

Kah0ona commented Feb 1, 2019

So for instance when get-access-token runs, it makes a POST call. This has the default clj-http middleware. This should work fine, but I have ran into an issue where the endpoint that is called contains a bug or returns some unexpected/malformed cookie, causing my POST to crash on wrap-cookies for instance.

I worked around this by forking this repo and wrap (clj-http.client/with-middleware ...) around it.

so the enhancement would be to enable the :middleware profile configuration key, and provide a middleware stack there. If nothing configured, it just doesn't do the with-middleware wrappery.

This makes the lib a bit more resilient, if it crashes. But I wonder if this is too far fetched? My feature suggestion is however fairly non-intrusive.

@weavejester
Copy link
Owner

The problem with adding the middleware stack as an option means we can't move away from clj-http in future. I don't believe we need cookie middleware on clj-http for OAuth2, so perhaps it should be removed by default?

@Kah0ona
Copy link
Contributor Author

Kah0ona commented Feb 1, 2019

Ah yeah I agree. So then we would need to wrap it in (with-middleware ...) and provide a new stack.

I could make a PR for that if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants