mirror of
https://github.com/metosin/reitit.git
synced 2025-12-18 08:51:12 +00:00
Merge pull request #443 from skibe/resource-handler-path-size-fix
Fix resource handler path matching
This commit is contained in:
commit
21df83c804
2 changed files with 7 additions and 5 deletions
|
|
@ -221,8 +221,8 @@
|
|||
handler (if path
|
||||
(fn [request]
|
||||
(let [uri (:uri request)]
|
||||
(if-let [path (if (>= (count uri) path-size) (subs uri path-size))]
|
||||
(path-or-index-response path uri))))
|
||||
(if (.startsWith uri path)
|
||||
(path-or-index-response (subs uri path-size) uri))))
|
||||
(fn [request]
|
||||
(let [uri (:uri request)
|
||||
path (-> request :path-params parameter)]
|
||||
|
|
|
|||
|
|
@ -491,6 +491,8 @@
|
|||
|
||||
(testing "not found"
|
||||
(let [response (app (request "/not-found"))]
|
||||
(is (= 404 (:status response))))
|
||||
(let [response (app {:uri "/XXXXX/hello.json" :request-method :get})]
|
||||
(is (= 404 (:status response)))))
|
||||
|
||||
(testing "3-arity"
|
||||
|
|
|
|||
Loading…
Reference in a new issue