From 1737a76e1ff50a864edbef8d27ebd915cb954c89 Mon Sep 17 00:00:00 2001 From: Farid AYOUJIL Date: Tue, 2 Feb 2021 09:53:42 +0100 Subject: [PATCH] Adding Chi's GetHead middleware (#14541) 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 --- routers/routes/web.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routers/routes/web.go b/routers/routes/web.go index f2b68aa10a5..1f860a62394 100644 --- a/routers/routes/web.go +++ b/routers/routes/web.go @@ -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())