docs: Improve ctx.Locals method documentation (#3033)

pull/2984/head^2
Jason McNeil 2024-06-12 11:23:15 -03:00 committed by GitHub
parent 6c9510df5a
commit 232c0fac0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

4
ctx.go
View File

@ -967,6 +967,10 @@ func (c *Ctx) Links(link ...string) {
// Locals makes it possible to pass interface{} values under keys scoped to the request
// and therefore available to all following routes that match the request.
//
// All the values are removed from ctx after returning from the top
// RequestHandler. Additionally, Close method is called on each value
// implementing io.Closer before removing the value from ctx.
func (c *Ctx) Locals(key interface{}, value ...interface{}) interface{} {
if len(value) == 0 {
return c.fasthttp.UserValue(key)