Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func IsValidHandlerFunc(handler HandlerFunc) bool {
secondParam = secondParam.Elem()
}
// Check if it's a struct or map type
if secondParam.Kind() != reflect.Struct && secondParam.Kind() != reflect.Map {
if secondParam.Kind() != reflect.Struct && secondParam.Kind() != reflect.Map && secondParam.Kind() != reflect.Interface {
return false
}
}
Expand Down
5 changes: 5 additions & 0 deletions engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ func TestIsValidHandlerFunc(t *testing.T) {
handler: func(ctx *fox.Context, args map[string]any) ([]byte, *HTTPError) { return nil, nil },
expected: true,
},
{
name: "HTTP error with interface parameter",
handler: func(ctx *fox.Context, args any) ([]byte, *HTTPError) { return nil, nil },
expected: true,
},
{
name: "Non-error second return type",
handler: func(ctx *fox.Context) (string, string) { return "", "" },
Expand Down