From 7295b9cbd77057eab0fa99fa45421d83203cfaba Mon Sep 17 00:00:00 2001 From: Liam Chen Date: Tue, 10 May 2022 14:28:40 -0400 Subject: [PATCH] Revert formatting changes --- src/compojure/core.clj | 18 ++++++++++-------- test/compojure/core_test.clj | 4 ++-- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/compojure/core.clj b/src/compojure/core.clj index 304cfb8..2400fc8 100644 --- a/src/compojure/core.clj +++ b/src/compojure/core.clj @@ -262,6 +262,8 @@ (defn- context-request [request route context-path] (if-let [params (clout/route-matches route request)] (let [uri (:uri request) + path (:path-info request uri) + context (or (:context request) "") subpath (:__path-info params) params (dissoc params :__path-info)] (-> request @@ -274,17 +276,17 @@ (let [re-context {:__path-info #"|/.*"}] (cond (string? route) - (clout/route-compile (str route ":__path-info") re-context) + (clout/route-compile (str route ":__path-info") re-context) (and (vector? route) (literal? route)) - (clout/route-compile - (str (first route) ":__path-info") - (merge (apply hash-map (rest route)) re-context)) + (clout/route-compile + (str (first route) ":__path-info") + (merge (apply hash-map (rest route)) re-context)) (vector? route) - `(clout/route-compile - (str ~(first route) ":__path-info") - ~(merge (apply hash-map (rest route)) re-context)) + `(clout/route-compile + (str ~(first route) ":__path-info") + ~(merge (apply hash-map (rest route)) re-context)) :else - `(clout/route-compile (str ~route ":__path-info") ~re-context)))) + `(clout/route-compile (str ~route ":__path-info") ~re-context)))) (defn ^:no-doc make-context [route path make-handler] (letfn [(handler diff --git a/test/compojure/core_test.clj b/test/compojure/core_test.clj index cf35e70..596e8c0 100644 --- a/test/compojure/core_test.clj +++ b/test/compojure/core_test.clj @@ -212,7 +212,7 @@ (let [handler (GET "/ip/:ip" [ip] ip) cxt-handler (context "/ip/:ip" [ip] (GET "/" [] ip)) in-cxt-handler (context "/ip" [] (GET "/:ip" [ip] ip)) - request (mock/request :get "/ip/0%3A0%3A0%3A0%3A0%3A0%3A0%3A1%250")] + request (mock/request :get "/ip/0%3A0%3A0%3A0%3A0%3A0%3A0%3A1%250") ] (is (= (-> request handler :body) "0:0:0:0:0:0:0:1%0")) (is (= (-> request cxt-handler :body) "0:0:0:0:0:0:0:1%0")) (is (= (-> request in-cxt-handler :body) "0:0:0:0:0:0:0:1%0")))) @@ -221,7 +221,7 @@ (let [handler (GET "/emote/:emote" [emote] emote) cxt-handler (context "/emote/:emote" [emote] (GET "/" [] emote)) in-cxt-handler (context "/emote" [] (GET "/:emote" [emote] emote)) - request (mock/request :get "/emote/%5C%3F%2F")] + request (mock/request :get "/emote/%5C%3F%2F") ] (is (= (-> request handler :body) "\\?/")) (is (= (-> request cxt-handler :body) "\\?/")) (is (= (-> request in-cxt-handler :body) "\\?/"))))