Skip to content

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

@SevereOverfl0w

Description

@SevereOverfl0w

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions