File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ func Wrap(handlers ...interface{}) http.HandlerFunc {
31
31
func (ctx * context.Context ) goctx.CancelFunc ,
32
32
func (* context.APIContext ),
33
33
func (* context.PrivateContext ),
34
+ func (* context.PrivateContext ) goctx.CancelFunc ,
34
35
func (http.Handler ) http.Handler :
35
36
default :
36
37
panic (fmt .Sprintf ("Unsupported handler type: %#v" , t ))
@@ -59,6 +60,15 @@ func Wrap(handlers ...interface{}) http.HandlerFunc {
59
60
if ctx .Written () {
60
61
return
61
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
+ }
62
72
case func (ctx * context.Context ):
63
73
ctx := context .GetContext (req )
64
74
t (ctx )
You can’t perform that action at this time.
0 commit comments