fix: panic when getting requests

This commit is contained in:
Henrique Dias
2024-07-22 18:32:57 +02:00
parent 3688420246
commit 7542860a47
+1 -2
View File
@@ -15,7 +15,6 @@ type handlerUser struct {
}
type Handler struct {
*Config
user *handlerUser
users map[string]*handlerUser
}
@@ -70,7 +69,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
user := h.user
// Authentication
if h.Auth {
if len(h.users) > 0 {
w.Header().Set("WWW-Authenticate", `Basic realm="Restricted"`)
// Gets the correct user for this request.