fix issue on binding sessions caused by variadic cookie options, as reported at: https://github.com/kataras/iris/issues/1197

Former-commit-id: 595a347706b6816729939a2e9d9098f5d3f72304
This commit is contained in:
Gerasimos (Makis) Maropoulos 2019-02-17 16:10:25 +02:00
parent 701267e034
commit eb22309aec

View File

@ -36,7 +36,8 @@ func init() {
}
di.DefaultTypeChecker = func(fn reflect.Type) bool {
// valid if that single input arg is a typeof context.Context.
return fn.NumIn() == 1 && IsContext(fn.In(0))
// valid if that single input arg is a typeof context.Context
// or first argument is context.Context and second argument is a variadic, which is ignored (i.e new sessions#Start).
return (fn.NumIn() == 1 || (fn.NumIn() == 2 && fn.IsVariadic())) && IsContext(fn.In(0))
}
}