From 9be5d8235eb624731106b7cc9b39bb3e8929d513 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Tue, 20 Feb 2024 08:00:45 -0700 Subject: [PATCH] oknow ctx bad --- cmd/server/main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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