Skip to content

Commit

Permalink
Adding Chi's GetHead middleware (#14541)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
faridtsl and lunny authored Feb 2, 2021
1 parent 3f332a9 commit 1737a76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion routers/routes/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 1737a76

Please sign in to comment.