mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-04 17:58:14 +08:00
Merge b91e9e6f3a4115b9c5626aa025fd72db1357b6e5 into cb2b764cc8a8613b84c44c45b8b2b1ba9da6244d
This commit is contained in:
commit
06d798fe9c
@ -302,7 +302,10 @@ func (c *Context) MustGet(key any) any {
|
|||||||
|
|
||||||
func getTyped[T any](c *Context, key any) (res T) {
|
func getTyped[T any](c *Context, key any) (res T) {
|
||||||
if val, ok := c.Get(key); ok && val != nil {
|
if val, ok := c.Get(key); ok && val != nil {
|
||||||
res, _ = val.(T)
|
res, ok = val.(T)
|
||||||
|
if !ok {
|
||||||
|
debugPrint("[WARNING] failed to convert key %v with value %v to type %T", key, val, res)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user