Merge pull request #730 from agorgl/index-redirect-default

Change default index-redirect? value to false
This commit is contained in:
Juho Teperi 2025-03-28 15:27:14 +02:00 committed by GitHub
commit 44d54cc9f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 21 additions and 21 deletions

View file

@ -231,7 +231,7 @@
:or {parameter (keyword "") :or {parameter (keyword "")
root "public" root "public"
index-files ["index.html"] index-files ["index.html"]
index-redirect? true index-redirect? false
canonicalize-uris? true canonicalize-uris? true
paths (constantly nil)}}] paths (constantly nil)}}]
(let [options {:root root (let [options {:root root

View file

@ -386,9 +386,9 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= (redirect "/docs/index.html") response)))) (is (= 200 (:status response)))))
(testing "not found" (testing "not found"
(let [response (app (request "/not-found"))] (let [response (app (request "/not-found"))]
@ -424,9 +424,9 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= (redirect "/docs/index.html") response)))) (is (= 200 (:status response)))))
(testing "not found" (testing "not found"
(let [response (app (request "/not-found"))] (let [response (app (request "/not-found"))]
@ -463,9 +463,9 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= (redirect "/docs/index.html") response)))) (is (= 200 (:status response)))))
(testing "not found" (testing "not found"
(let [response (app (request "/not-found"))] (let [response (app (request "/not-found"))]
@ -502,9 +502,9 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= (redirect "/docs/index.html") response)))) (is (= 200 (:status response)))))
(testing "not found" (testing "not found"
(let [response (app (request "/not-found"))] (let [response (app (request "/not-found"))]

View file

@ -337,7 +337,7 @@
{:path "/" {:path "/"
:url "/openapi.json" :url "/openapi.json"
:config {:jsonEditor true}})] :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 (= 200 (:status (app {:request-method :get, :uri "/index.html"}))))
(is (= {:jsonEditor true, :url "/openapi.json"} (is (= {:jsonEditor true, :url "/openapi.json"}
(->> {:request-method :get, :uri "/config.json"} (->> {:request-method :get, :uri "/config.json"}

View file

@ -526,9 +526,9 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= (redirect "/docs/index.html") response)))) (is (= 200 (:status response)))))
(testing "not found" (testing "not found"
(let [response (app (request "/not-found"))] (let [response (app (request "/not-found"))]
@ -567,9 +567,9 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= (redirect "/docs/index.html") response)))) (is (= 200 (:status response)))))
(testing "not found" (testing "not found"
(let [response (app (request "/not-found"))] (let [response (app (request "/not-found"))]
@ -609,9 +609,9 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= (redirect "/docs/index.html") response)))) (is (= 200 (:status response)))))
(testing "not found" (testing "not found"
(let [response (app (request "/not-found"))] (let [response (app (request "/not-found"))]
@ -652,9 +652,9 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= (redirect "/docs/index.html") response)))) (is (= 200 (:status response)))))
(testing "not found" (testing "not found"
(let [response (app {:uri "/not-found" :request-method :get})] (let [response (app {:uri "/not-found" :request-method :get})]
@ -707,12 +707,12 @@
(testing "index-files" (testing "index-files"
(let [response (app (request "/docs"))] (let [response (app (request "/docs"))]
(is (= (redirect "/docs/index.html") response))) (is (= (redirect "/docs/") response)))
(testing "not found if dir doesn't exist" (testing "not found if dir doesn't exist"
(let [response (app (request "/foobar"))] (let [response (app (request "/foobar"))]
(is (= 404 (:status response))))) (is (= 404 (:status response)))))
(let [response (app (request "/docs/"))] (let [response (app (request "/docs/"))]
(is (= 302 (:status response)))) (is (= 200 (:status response))))
(let [response (app (request "/docs/index.html"))] (let [response (app (request "/docs/index.html"))]
(is (= 200 (:status response))))))) (is (= 200 (:status response)))))))

View file

@ -392,7 +392,7 @@
(let [app (swagger-ui/create-swagger-ui-handler (let [app (swagger-ui/create-swagger-ui-handler
{:path "/" {:path "/"
:config {:jsonEditor true}})] :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 (= 200 (:status (app {:request-method :get, :uri "/index.html"}))))
(is (= {:jsonEditor true, :url "/swagger.json"} (is (= {:jsonEditor true, :url "/swagger.json"}
(->> {:request-method :get, :uri "/config.json"} (->> {:request-method :get, :uri "/config.json"}