Merge branch 'master' of github.com:metosin/reitit

This commit is contained in:
Tommi Reiman 2021-08-03 13:36:09 +03:00
commit 10747acb00
4 changed files with 30 additions and 5 deletions

View file

@ -27,6 +27,10 @@ We use [Break Versioning][breakver]. The version numbers follow a `<major>.<mino
[io.pedestal/pedestal.service "0.5.9"] is available but we use "0.5.8"
```
### `reitit-ring`
* Fixes `reitit.ring/create-resource-handler` and `reitit.ring/create-file-handler` to support URL-escaped characters. [#484](https://github.com/metosin/reitit/issues/484). PR [#489](https://github.com/metosin/reitit/pull/489).
### `reitit-malli`
* FIX: Malli response coercision seems to do nothing at all [#498](https://github.com/metosin/reitit/pull/501)

View file

@ -0,0 +1 @@
hello

View file

@ -222,12 +222,12 @@
(recur files))))))
handler (if path
(fn [request]
(let [uri (:uri request)]
(let [uri (impl/url-decode (:uri request))]
(if (str/starts-with? uri path)
(or (path-or-index-response (subs uri path-size) uri)
(not-found-handler request)))))
(fn [request]
(let [uri (:uri request)
(let [uri (impl/url-decode (:uri request))
path (-> request :path-params parameter)]
(or (path-or-index-response path uri)
(not-found-handler request)))))]

View file

@ -471,9 +471,9 @@
(testing "from root"
(let [app (ring/ring-handler
(ring/router
["/*" (create nil)])
(ring/create-default-handler))]
(ring/router
["/*" (create nil)])
(ring/create-default-handler))]
(testing "different file-types"
(let [response (app (request "/hello.json"))]
(is (= "application/json" (get-in response [:headers "Content-Type"])))
@ -484,6 +484,11 @@
(is (get-in response [:headers "Last-Modified"]))
(is (= "<xml><hello>file</hello></xml>\n" (slurp (:body response))))))
(testing "with url decoding"
(let [response (app (request "/with%20space.txt"))]
(is (= 200 (:status response)))
(is (= "hello\n" (slurp (:body response))))))
(testing "index-files"
(let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response)))
@ -520,6 +525,11 @@
(is (get-in response [:headers "Last-Modified"]))
(is (= "<xml><hello>file</hello></xml>\n" (slurp (:body response))))))
(testing "with url decoding"
(let [response (app (request "/with%20space.txt"))]
(is (= 200 (:status response)))
(is (= "hello\n" (slurp (:body response))))))
(testing "index-files"
(let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response)))
@ -557,6 +567,11 @@
(is (get-in response [:headers "Last-Modified"]))
(is (= "<xml><hello>file</hello></xml>\n" (slurp (:body response))))))
(testing "with url decoding"
(let [response (app (request "/with%20space.txt"))]
(is (= 200 (:status response)))
(is (= "hello\n" (slurp (:body response))))))
(testing "index-files"
(let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response)))
@ -595,6 +610,11 @@
(is (get-in response [:headers "Last-Modified"]))
(is (= "<xml><hello>file</hello></xml>\n" (slurp (:body response))))))
(testing "with url decoding"
(let [response (app (request "/with%20space.txt"))]
(is (= 200 (:status response)))
(is (= "hello\n" (slurp (:body response))))))
(testing "index-files"
(let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response)))