]> source.dussan.org Git - gitea.git/commitdiff
Adding Chi's GetHead middleware (#14541)
authorFarid AYOUJIL <faridtsl@users.noreply.github.com>
Tue, 2 Feb 2021 08:53:42 +0000 (09:53 +0100)
committerGitHub <noreply@github.com>
Tue, 2 Feb 2021 08:53:42 +0000 (10:53 +0200)
Before moving to Chi, HEAD requests were automatically answered by GET
handlers (SetAutoHead(true) from macaron was used).

This Change will restore the previous behaviour.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
routers/routes/web.go

index f2b68aa10a57934104cacae2dc78bd473ab1b5ac..1f860a6239497098476f17b998ce9e85b9a22311 100644 (file)
@@ -162,7 +162,8 @@ func WebRoutes() *web.Route {
        }
        // Removed: toolbox.Toolboxer middleware will provide debug informations which seems unnecessary
        r.Use(context.Contexter())
-       // Removed: SetAutoHead allow a get request redirect to head if get method is not exist
+       // GetHead allows a HEAD request redirect to GET if HEAD method is not defined for that route
+       r.Use(middleware.GetHead)
 
        if setting.EnableAccessLog {
                r.Use(context.AccessLogger())