1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-24 04:15:56 +00:00

Update to version 12.1.8 - Read HISTORY.md

Former-commit-id: d3d30cb15537146e3071731be9d674a5cb59de97
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-02-16 11:14:35 +02:00
parent 899aec8b19
commit 08403f0317
21 changed files with 275 additions and 240 deletions

View File

@@ -11,31 +11,17 @@ import (
"github.com/kataras/golog"
)
var contextTyp = reflect.TypeOf((*context.Context)(nil)).Elem()
// var genericFuncTyp = reflect.TypeOf(func(context.Context) reflect.Value { return reflect.Value{} })
// IsContext returns true if the "inTyp" is a type of Context.
func IsContext(inTyp reflect.Type) bool {
return inTyp.Implements(contextTyp)
}
// var genericFuncTyp = reflect.TypeOf(func(context.Context) interface{} { return nil })
var genericFuncTyp = reflect.TypeOf(func(context.Context) reflect.Value { return reflect.Value{} })
// IsGenericFunc reports whether the "inTyp" is a type of func(Context) interface{}.
func IsGenericFunc(inTyp reflect.Type) bool {
return inTyp == genericFuncTyp
}
// // IsGenericFunc reports whether the "inTyp" is a type of func(Context) interface{}.
// func IsGenericFunc(inTyp reflect.Type) bool {
// return inTyp == genericFuncTyp
// }
// checks if "handler" is context.Handler: func(context.Context).
func isContextHandler(handler interface{}) (context.Handler, bool) {
h, is := handler.(context.Handler)
if !is {
fh, is := handler.(func(context.Context))
if is {
return fh, is
}
}
return h, is
h, ok := handler.(context.Handler)
return h, ok
}
func validateHandler(handler interface{}) error {
@@ -72,7 +58,7 @@ func makeHandler(handler interface{}, errorHandler di.ErrorHandler, values ...re
}
funcInjector := di.Func(fn, values...)
funcInjector.ErrorHandler(errorHandler)
funcInjector.ErrorHandler = errorHandler
valid := funcInjector.Length == n