Ring middlewares that help integrate with clj-http in ring applications.
NOTE: Because the internals depend on thread-local bindings, these middlewares cannot be used with async handlers.
Assuming some clj-http middleware named client-middleware
, the following will
wrap any HTTP calls from clj-http with the specified client middleware.
(require '[ring.middleware.client :refer [wrap-client-middleware]])
(def handler
(wrap-client-middleware my-routes client-middleware))
If you need a more dynamic solution, you may use the
wrap-client-middleware-builder
function. Instead of accepting a middleware
directly, it accepts a function that receives a ring request and returns a
clj-http middleware. The resulting middleware is applied in the same manner
as demonstrated above.
Copyright © 2019 Thomas C. Taylor
Distributed under the Eclipse Public License version 2.0.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close