mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
Change default index-redirect? value to false
Signed-off-by: Loukas Agorgianitis <loukas@agorgianitis.com>
This commit is contained in:
parent
8fb44467a0
commit
3342e77538
5 changed files with 21 additions and 21 deletions
|
|
@ -231,7 +231,7 @@
|
|||
:or {parameter (keyword "")
|
||||
root "public"
|
||||
index-files ["index.html"]
|
||||
index-redirect? true
|
||||
index-redirect? false
|
||||
canonicalize-uris? true
|
||||
paths (constantly nil)}}]
|
||||
(let [options {:root root
|
||||
|
|
|
|||
|
|
@ -386,9 +386,9 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= (redirect "/docs/index.html") response))))
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not found"
|
||||
(let [response (app (request "/not-found"))]
|
||||
|
|
@ -424,9 +424,9 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= (redirect "/docs/index.html") response))))
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not found"
|
||||
(let [response (app (request "/not-found"))]
|
||||
|
|
@ -463,9 +463,9 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= (redirect "/docs/index.html") response))))
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not found"
|
||||
(let [response (app (request "/not-found"))]
|
||||
|
|
@ -502,9 +502,9 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= (redirect "/docs/index.html") response))))
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not found"
|
||||
(let [response (app (request "/not-found"))]
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@
|
|||
{:path "/"
|
||||
:url "/openapi.json"
|
||||
:config {:jsonEditor true}})]
|
||||
(is (= 302 (:status (app {:request-method :get, :uri "/"}))))
|
||||
(is (= 200 (:status (app {:request-method :get, :uri "/"}))))
|
||||
(is (= 200 (:status (app {:request-method :get, :uri "/index.html"}))))
|
||||
(is (= {:jsonEditor true, :url "/openapi.json"}
|
||||
(->> {:request-method :get, :uri "/config.json"}
|
||||
|
|
|
|||
|
|
@ -526,9 +526,9 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= (redirect "/docs/index.html") response))))
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not found"
|
||||
(let [response (app (request "/not-found"))]
|
||||
|
|
@ -567,9 +567,9 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= (redirect "/docs/index.html") response))))
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not found"
|
||||
(let [response (app (request "/not-found"))]
|
||||
|
|
@ -609,9 +609,9 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= (redirect "/docs/index.html") response))))
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not found"
|
||||
(let [response (app (request "/not-found"))]
|
||||
|
|
@ -652,9 +652,9 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= (redirect "/docs/index.html") response))))
|
||||
(is (= 200 (:status response)))))
|
||||
|
||||
(testing "not found"
|
||||
(let [response (app {:uri "/not-found" :request-method :get})]
|
||||
|
|
@ -707,12 +707,12 @@
|
|||
|
||||
(testing "index-files"
|
||||
(let [response (app (request "/docs"))]
|
||||
(is (= (redirect "/docs/index.html") response)))
|
||||
(is (= (redirect "/docs/") response)))
|
||||
(testing "not found if dir doesn't exist"
|
||||
(let [response (app (request "/foobar"))]
|
||||
(is (= 404 (:status response)))))
|
||||
(let [response (app (request "/docs/"))]
|
||||
(is (= 302 (:status response))))
|
||||
(is (= 200 (:status response))))
|
||||
(let [response (app (request "/docs/index.html"))]
|
||||
(is (= 200 (:status response)))))))
|
||||
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@
|
|||
(let [app (swagger-ui/create-swagger-ui-handler
|
||||
{:path "/"
|
||||
:config {:jsonEditor true}})]
|
||||
(is (= 302 (:status (app {:request-method :get, :uri "/"}))))
|
||||
(is (= 200 (:status (app {:request-method :get, :uri "/"}))))
|
||||
(is (= 200 (:status (app {:request-method :get, :uri "/index.html"}))))
|
||||
(is (= {:jsonEditor true, :url "/swagger.json"}
|
||||
(->> {:request-method :get, :uri "/config.json"}
|
||||
|
|
|
|||
Loading…
Reference in a new issue