mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-16 21:32:11 +08:00
Merge 2d85e33ef68380f936bea62cd710208088f52011 into fb8a113f8d2d526e57d3623dbd4b9fa12c40d0f7
This commit is contained in:
commit
841084af79
11
context.go
11
context.go
@ -1153,19 +1153,19 @@ func (c *Context) SetAccepted(formats ...string) {
|
||||
// Deadline always returns that there is no deadline (ok==false),
|
||||
// maybe you want to use Request.Context().Deadline() instead.
|
||||
func (c *Context) Deadline() (deadline time.Time, ok bool) {
|
||||
return
|
||||
return c.Request.Context().Deadline()
|
||||
}
|
||||
|
||||
// Done always returns nil (chan which will wait forever),
|
||||
// if you want to abort your work when the connection was closed
|
||||
// you should use Request.Context().Done() instead.
|
||||
func (c *Context) Done() <-chan struct{} {
|
||||
return nil
|
||||
return c.Request.Context().Done()
|
||||
}
|
||||
|
||||
// Err always returns nil, maybe you want to use Request.Context().Err() instead.
|
||||
func (c *Context) Err() error {
|
||||
return nil
|
||||
return c.Request.Context().Err()
|
||||
}
|
||||
|
||||
// Value returns the value associated with this context for key, or nil
|
||||
@ -1176,8 +1176,9 @@ func (c *Context) Value(key interface{}) interface{} {
|
||||
return c.Request
|
||||
}
|
||||
if keyAsString, ok := key.(string); ok {
|
||||
val, _ := c.Get(keyAsString)
|
||||
if val, ok := c.Get(keyAsString); ok {
|
||||
return val
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return c.Request.Context().Value(key)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user