From 232c0fac0df214d08ece49cf210b9b256997bdf1 Mon Sep 17 00:00:00 2001 From: Jason McNeil Date: Wed, 12 Jun 2024 11:23:15 -0300 Subject: [PATCH] docs: Improve ctx.Locals method documentation (#3033) --- ctx.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ctx.go b/ctx.go index 596268e9fe..2589f0e3e7 100644 --- a/ctx.go +++ b/ctx.go @@ -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)