@@ -7,7 +7,6 @@ package fiber
7
7
import (
8
8
"bufio"
9
9
"bytes"
10
- "context"
11
10
"crypto/tls"
12
11
"errors"
13
12
"fmt"
@@ -41,10 +40,7 @@ const (
41
40
42
41
// The contextKey type is unexported to prevent collisions with context keys defined in
43
42
// other packages.
44
- type contextKey int
45
-
46
- // userContextKey define the key name for storing context.Context in *fasthttp.RequestCtx
47
- const userContextKey contextKey = 0 // __local_user_context__
43
+ type contextKey int //nolint:unused // need for future (nolintlint)
48
44
49
45
// DefaultCtx is the default implementation of the Ctx interface
50
46
// generation tool `go install github.com/vburenin/ifacemaker@975a95966976eeb2d4365a7fb236e274c54da64c`
@@ -391,23 +387,6 @@ func (c *DefaultCtx) RequestCtx() *fasthttp.RequestCtx {
391
387
return c .fasthttp
392
388
}
393
389
394
- // Context returns a context implementation that was set by
395
- // user earlier or returns a non-nil, empty context,if it was not set earlier.
396
- func (c * DefaultCtx ) Context () context.Context {
397
- ctx , ok := c .fasthttp .UserValue (userContextKey ).(context.Context )
398
- if ! ok {
399
- ctx = context .Background ()
400
- c .SetContext (ctx )
401
- }
402
-
403
- return ctx
404
- }
405
-
406
- // SetContext sets a context implementation by user.
407
- func (c * DefaultCtx ) SetContext (ctx context.Context ) {
408
- c .fasthttp .SetUserValue (userContextKey , ctx )
409
- }
410
-
411
390
// Cookie sets a cookie by passing a cookie struct.
412
391
func (c * DefaultCtx ) Cookie (cookie * Cookie ) {
413
392
fcookie := fasthttp .AcquireCookie ()
@@ -1838,12 +1817,8 @@ func (c *DefaultCtx) Vary(fields ...string) {
1838
1817
c .Append (HeaderVary , fields ... )
1839
1818
}
1840
1819
1841
- // Value makes it possible to pass any values under keys scoped to the request
1820
+ // Value makes it possible to retrieve values (Locals) under keys scoped to the request
1842
1821
// and therefore available to all following routes that match the request.
1843
- //
1844
- // All the values are removed from ctx after returning from the top
1845
- // RequestHandler. Additionally, Close method is called on each value
1846
- // implementing io.Closer before removing the value from ctx.
1847
1822
func (c * DefaultCtx ) Value (key any ) any {
1848
1823
return c .fasthttp .UserValue (key )
1849
1824
}
0 commit comments