diff options
author | Farid AYOUJIL <faridtsl@users.noreply.github.com> | 2021-02-02 09:53:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-02 10:53:42 +0200 |
commit | 1737a76e1ff50a864edbef8d27ebd915cb954c89 (patch) | |
tree | fb6b5313569fc7a4dad615c4bedb5806ac7629f8 | |
parent | 3f332a99195b3a0a988b75bd8fb6218651fc5d90 (diff) | |
download | gitea-1737a76e1ff50a864edbef8d27ebd915cb954c89.tar.gz gitea-1737a76e1ff50a864edbef8d27ebd915cb954c89.zip |
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 <xiaolunwen@gmail.com>
-rw-r--r-- | routers/routes/web.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/routes/web.go b/routers/routes/web.go index f2b68aa10a..1f860a6239 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()) |