0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-24 08:06:49 -05:00

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>
This commit is contained in:
Farid AYOUJIL 2021-02-02 09:53:42 +01:00 committed by GitHub
parent 3f332a9919
commit 1737a76e1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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())