Skip to content

Commit 777bc0b

Browse files
committed
Remove vararg workaround from test middlewares
This was probably originally used because middleware macro and restructuring used to call the middleware with multiple arities. This has now been fixed.
1 parent 1b5bb9b commit 777bc0b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

test/compojure/api/integration_test.clj

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@
3636

3737
(defn middleware*
3838
"This middleware appends given value or 1 to a header in request and response."
39-
[handler & [value]]
40-
(fn [request]
41-
(let [append #(str % (or value 1))
42-
request (update-in request [:headers mw*] append)
43-
response (handler request)]
44-
(update-in response [:headers mw*] append))))
39+
([handler] (middleware* handler 1))
40+
([handler value]
41+
(fn [request]
42+
(let [append #(str % value)
43+
request (update-in request [:headers mw*] append)
44+
response (handler request)]
45+
(update-in response [:headers mw*] append)))))
4546

4647
(defn constant-middleware
4748
"This middleware rewrites all responses with a constant response."
48-
[_ & [res]] (constantly res))
49+
[_ res]
50+
(constantly res))
4951

5052
(defn reply-mw*
5153
"Handler which replies with response where a header contains copy

0 commit comments

Comments
 (0)