Skip to content

Commit 7295b9c

Browse files
committed
Revert formatting changes
1 parent f185750 commit 7295b9c

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/compojure/core.clj

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@
262262
(defn- context-request [request route context-path]
263263
(if-let [params (clout/route-matches route request)]
264264
(let [uri (:uri request)
265+
path (:path-info request uri)
266+
context (or (:context request) "")
265267
subpath (:__path-info params)
266268
params (dissoc params :__path-info)]
267269
(-> request
@@ -274,17 +276,17 @@
274276
(let [re-context {:__path-info #"|/.*"}]
275277
(cond
276278
(string? route)
277-
(clout/route-compile (str route ":__path-info") re-context)
279+
(clout/route-compile (str route ":__path-info") re-context)
278280
(and (vector? route) (literal? route))
279-
(clout/route-compile
280-
(str (first route) ":__path-info")
281-
(merge (apply hash-map (rest route)) re-context))
281+
(clout/route-compile
282+
(str (first route) ":__path-info")
283+
(merge (apply hash-map (rest route)) re-context))
282284
(vector? route)
283-
`(clout/route-compile
284-
(str ~(first route) ":__path-info")
285-
~(merge (apply hash-map (rest route)) re-context))
285+
`(clout/route-compile
286+
(str ~(first route) ":__path-info")
287+
~(merge (apply hash-map (rest route)) re-context))
286288
:else
287-
`(clout/route-compile (str ~route ":__path-info") ~re-context))))
289+
`(clout/route-compile (str ~route ":__path-info") ~re-context))))
288290

289291
(defn ^:no-doc make-context [route path make-handler]
290292
(letfn [(handler

test/compojure/core_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@
212212
(let [handler (GET "/ip/:ip" [ip] ip)
213213
cxt-handler (context "/ip/:ip" [ip] (GET "/" [] ip))
214214
in-cxt-handler (context "/ip" [] (GET "/:ip" [ip] ip))
215-
request (mock/request :get "/ip/0%3A0%3A0%3A0%3A0%3A0%3A0%3A1%250")]
215+
request (mock/request :get "/ip/0%3A0%3A0%3A0%3A0%3A0%3A0%3A1%250") ]
216216
(is (= (-> request handler :body) "0:0:0:0:0:0:0:1%0"))
217217
(is (= (-> request cxt-handler :body) "0:0:0:0:0:0:0:1%0"))
218218
(is (= (-> request in-cxt-handler :body) "0:0:0:0:0:0:0:1%0"))))
@@ -221,7 +221,7 @@
221221
(let [handler (GET "/emote/:emote" [emote] emote)
222222
cxt-handler (context "/emote/:emote" [emote] (GET "/" [] emote))
223223
in-cxt-handler (context "/emote" [] (GET "/:emote" [emote] emote))
224-
request (mock/request :get "/emote/%5C%3F%2F")]
224+
request (mock/request :get "/emote/%5C%3F%2F") ]
225225
(is (= (-> request handler :body) "\\?/"))
226226
(is (= (-> request cxt-handler :body) "\\?/"))
227227
(is (= (-> request in-cxt-handler :body) "\\?/"))))

0 commit comments

Comments
 (0)