github.com/goravel/framework@v1.13.9/http/context.go (about) 1 package http 2 3 import ( 4 "context" 5 6 "github.com/goravel/framework/contracts/http" 7 ) 8 9 func Background() http.Context { 10 return NewContext() 11 } 12 13 type Ctx context.Context 14 15 type Context struct { 16 Ctx 17 } 18 19 func NewContext() *Context { 20 return &Context{ 21 Ctx: context.Background(), 22 } 23 } 24 25 func (r *Context) Context() context.Context { 26 return r.Ctx 27 } 28 29 func (r *Context) WithValue(key string, value any) { 30 //nolint:all 31 r.Ctx = context.WithValue(r.Ctx, key, value) 32 } 33 34 func (r *Context) Request() http.ContextRequest { 35 return nil 36 } 37 38 func (r *Context) Response() http.ContextResponse { 39 return nil 40 }