diff --git a/cmd/server/main.go b/cmd/server/main.go index f2fb698..31e62e9 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -66,6 +66,10 @@ func (cfg Config) NewHandler() Handler { } } +func (s Session) Empty() bool { + return s == (Session{}) +} + func runHTTP(ctx context.Context, cfg Config) error { server := &http.Server{ Addr: cfg.Addr, @@ -105,7 +109,7 @@ func (h Handler) serveHTTP(w http.ResponseWriter, r *http.Request) error { return h.handle(session, w, r) } -func (h Handler) auth(r *http.Request) (session, error) { +func (h Handler) auth(r *http.Request) (Session, error) { user, pass, ok := r.BasicAuth() if !ok { return Session{}, nil