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

with-middleware rebinds http/request with new core client #644

Open
SevereOverfl0w opened this issue Apr 8, 2024 · 0 comments
Open

with-middleware rebinds http/request with new core client #644

SevereOverfl0w opened this issue Apr 8, 2024 · 0 comments

Comments

@SevereOverfl0w
Copy link

If you have a function like this:

(defn make-request
  [request]
  (http/with-additional-middleware [...]
    (http/request request))) 

And you call it with mocking, like so:

(binding [http/request (http/make-request (constantly {:status 201}))]
  (make-request {...}))

Then the default client (clj-http.core/request) will be used instead of (constantly {:status 201}). This is due to with-middleware rebinding http/request itself

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

1 participant