From 3095d54f99c083b2a166958872d9f9273918817e Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Sun, 15 Dec 2024 14:34:59 -0700 Subject: [PATCH] testapi accepts ?uuid instead of cookie.uuid --- cmd/testapi/main.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cmd/testapi/main.go b/cmd/testapi/main.go index 1aaafa7..9e34183 100644 --- a/cmd/testapi/main.go +++ b/cmd/testapi/main.go @@ -122,13 +122,17 @@ type Session struct { } func (s *S) injectContext(w http.ResponseWriter, r *http.Request) error { - id, err := r.Cookie("uuid") - if err != nil || id.Value == "" { - return io.EOF + id := r.URL.Query().Get("uuid") + if id == "" { + c, err := r.Cookie("uuid") + if err != nil || c.Value == "" { + return io.EOF + } + id = c.Value } ctx := r.Context() ctx = context.WithValue(ctx, "session", Session{ - ID: id.Value, + ID: id, }) *r = *r.WithContext(ctx) return nil