Skip to content

Commit b649c49

Browse files
committed
Add the with-additional-middleware macro
`with-additional-middleware` concats the given middleware sequence to the beginning of *current-middleware* for the given body Resolves dakrone#227
1 parent 8ff7756 commit b649c49

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

changelog.org

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ List of user-visible changes that have gone into each release
6868
and clean up whitespace for new clojure-mode
6969
- Merged https://github.com/dakrone/clj-http/pull/171 to support SOCKS proxies
7070
* Work log
71+
** 2015-02-08
72+
- Add the `with-additional-middleware` macro
7173
** 2015-01-19
7274
- merged https://github.com/dakrone/clj-http/pull/248 to removed deprecated
7375
cookie APIs from cookie.clj

src/clj_http/client.clj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,15 @@
896896
m#)]
897897
~@body)))
898898

899+
(defmacro with-additional-middleware
900+
"Perform the body of the macro with a list of additional middleware.
901+
902+
The given `middleware-seq' is concatenated to the beginning of the
903+
`*current-middleware*' sequence."
904+
[middleware-seq & body]
905+
`(with-middleware (concat ~middleware-seq *current-middleware*)
906+
~@body))
907+
899908
(defmacro with-connection-pool
900909
"Macro to execute the body using a connection manager. Creates a
901910
PoolingClientConnectionManager to use for all requests within the body of

0 commit comments

Comments
 (0)