Skip to content

Commit 232c0fa

Browse files
authored
docs: Improve ctx.Locals method documentation (#3033)
1 parent 6c9510d commit 232c0fa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ctx.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -967,6 +967,10 @@ func (c *Ctx) Links(link ...string) {
967967

968968
// Locals makes it possible to pass interface{} values under keys scoped to the request
969969
// and therefore available to all following routes that match the request.
970+
//
971+
// All the values are removed from ctx after returning from the top
972+
// RequestHandler. Additionally, Close method is called on each value
973+
// implementing io.Closer before removing the value from ctx.
970974
func (c *Ctx) Locals(key interface{}, value ...interface{}) interface{} {
971975
if len(value) == 0 {
972976
return c.fasthttp.UserValue(key)

0 commit comments

Comments
 (0)