1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-22 04:17:03 +00:00

black-box the MakeHandler, works perfectly.

Former-commit-id: d325be0e953efc2f841c69f62233b34d4a58ab62
This commit is contained in:
kataras
2017-11-24 15:10:30 +02:00
parent bfec1d174f
commit 29835d9a8e
5 changed files with 126 additions and 51 deletions

View File

@@ -33,14 +33,15 @@ func isFunc(typ reflect.Type) bool {
return typ.Kind() == reflect.Func
}
func equalTypes(in reflect.Type, v reflect.Type) bool {
if in == v {
func equalTypes(got reflect.Type, expected reflect.Type) bool {
if got == expected {
return true
}
// if accepts an interface, check if the given "v" type does
// implement this.
if in.Kind() == reflect.Interface {
return v.Implements(in)
// if accepts an interface, check if the given "got" type does
// implement this "expected" user handler's input argument.
if expected.Kind() == reflect.Interface {
// fmt.Printf("expected interface = %s and got to set on the arg is: %s\n", expected.String(), got.String())
return got.Implements(expected)
}
return false
}