From 29d4aac7e2dd500ed1923159bd9f54e8130b8b08 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sat, 27 Apr 2024 16:13:12 +1000 Subject: [PATCH] Support window as second parameter --- v3/pkg/application/messageprocessor_call.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/v3/pkg/application/messageprocessor_call.go b/v3/pkg/application/messageprocessor_call.go index a40a23fd..a8c035d6 100644 --- a/v3/pkg/application/messageprocessor_call.go +++ b/v3/pkg/application/messageprocessor_call.go @@ -107,10 +107,14 @@ func (m *MessageProcessor) processCallMethod(method int, rw http.ResponseWriter, }() // Check if the first or second bound method parameter is a Window interface - if len(boundMethod.Inputs) > 1 && (boundMethod.Inputs[0].ReflectType == reflect.TypeFor[Window]() || - boundMethod.Inputs[1].ReflectType == reflect.TypeFor[Window]()) { - // Prepend the options.Args with the current window - options.Args = append([]interface{}{window}, options.Args...) + if len(boundMethod.Inputs) > 0 { + if boundMethod.Inputs[0].ReflectType == reflect.TypeFor[Window]() { + // Prepend the options.Args with the current window + options.Args = append([]interface{}{window}, options.Args...) + } else if len(boundMethod.Inputs) > 1 && boundMethod.Inputs[1].ReflectType == reflect.TypeFor[Window]() { + // Prepend the options.Args with the current window + options.Args = append([]interface{}{window}, options.Args...) + } } result, err := boundMethod.Call(ctx, options.Args) if err != nil {