testapi accepts ?uuid instead of cookie.uuid
parent
d6db4a8a58
commit
3095d54f99
|
|
@ -122,13 +122,17 @@ type Session struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *S) injectContext(w http.ResponseWriter, r *http.Request) error {
|
func (s *S) injectContext(w http.ResponseWriter, r *http.Request) error {
|
||||||
id, err := r.Cookie("uuid")
|
id := r.URL.Query().Get("uuid")
|
||||||
if err != nil || id.Value == "" {
|
if id == "" {
|
||||||
return io.EOF
|
c, err := r.Cookie("uuid")
|
||||||
|
if err != nil || c.Value == "" {
|
||||||
|
return io.EOF
|
||||||
|
}
|
||||||
|
id = c.Value
|
||||||
}
|
}
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
ctx = context.WithValue(ctx, "session", Session{
|
ctx = context.WithValue(ctx, "session", Session{
|
||||||
ID: id.Value,
|
ID: id,
|
||||||
})
|
})
|
||||||
*r = *r.WithContext(ctx)
|
*r = *r.WithContext(ctx)
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue