Change default index-redirect? value to false

Signed-off-by: Loukas Agorgianitis <loukas@agorgianitis.com>
This commit is contained in:
Loukas Agorgianitis 2025-03-28 13:57:15 +02:00
parent 8fb44467a0
commit 3342e77538
No known key found for this signature in database
GPG key ID: DDC6FA7D5BB332E6
5 changed files with 21 additions and 21 deletions

View file

@ -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

View file

@ -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"))]

View file

@ -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"}

View file

@ -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)))))))

View file

@ -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"}