diff --git a/cmd/server/server.go b/cmd/server/server.go index 6afce45..9bef28f 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -59,13 +59,19 @@ type Session struct { } func (s *S) injectContext(w http.ResponseWriter, r *http.Request) error { - id, err := r.Cookie("uuid") - if err != nil || id.Value == "" { + id := r.Header.Get("uuid") + if id == "" { + c, _ := r.Cookie("uuid") + if c != nil { + id = c.Value + } + } + if id == "" { return io.EOF } ctx := r.Context() ctx = context.WithValue(ctx, "session", Session{ - ID: id.Value, + ID: id, }) *r = *r.WithContext(ctx) return nil