We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75c01ee commit f14b465Copy full SHA for f14b465
modules/web/route.go
@@ -31,6 +31,7 @@ func Wrap(handlers ...interface{}) http.HandlerFunc {
31
func(ctx *context.Context) goctx.CancelFunc,
32
func(*context.APIContext),
33
func(*context.PrivateContext),
34
+ func(*context.PrivateContext) goctx.CancelFunc,
35
func(http.Handler) http.Handler:
36
default:
37
panic(fmt.Sprintf("Unsupported handler type: %#v", t))
@@ -59,6 +60,15 @@ func Wrap(handlers ...interface{}) http.HandlerFunc {
59
60
if ctx.Written() {
61
return
62
}
63
+ case func(*context.PrivateContext) goctx.CancelFunc:
64
+ ctx := context.GetPrivateContext(req)
65
+ cancel := t(ctx)
66
+ if cancel != nil {
67
+ defer cancel()
68
+ }
69
+ if ctx.Written() {
70
+ return
71
72
case func(ctx *context.Context):
73
ctx := context.GetContext(req)
74
t(ctx)
0 commit comments