Add HEAD request check in root endpoint to allow dashboard containing its own status

This commit is contained in:
Elara 2021-03-27 15:02:58 -07:00
parent 1f95f1e091
commit 3895fe2d08
1 changed files with 7 additions and 0 deletions

View File

@ -23,6 +23,13 @@ type TemplateData struct {
func registerRoutes(app App) {
// Root endpoint, home page
app.Route.Path("/").HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
// If HEAD request received
if req.Method == http.MethodHead {
// Reply with code 200 OK
res.WriteHeader(http.StatusOK)
// Return from function
return
}
// Get session by name from config
session, _ := app.Session.Get(req, app.Config.Session.Name)
// Attempt to get loggedInAs from session