Merge 2d85e33ef68380f936bea62cd710208088f52011 into fb8a113f8d2d526e57d3623dbd4b9fa12c40d0f7

This commit is contained in:
Andreas Jaekle 2021-06-23 14:10:33 +08:00 committed by GitHub
commit 841084af79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}