diff --git a/runtime/events.go b/runtime/events.go index 6c9b41e7f..55a882aad 100644 --- a/runtime/events.go +++ b/runtime/events.go @@ -37,7 +37,7 @@ const ( type EventHandlerFn func([]Event) error type EnableEventGenFn func(string, string) bool -type RedirectFn func(w http.ResponseWriter, r *http.Request) bool +type RedirectFn func(w http.ResponseWriter, r *http.Request, endpointGroup, endpointID string) bool type Event interface { Name() string @@ -131,6 +131,6 @@ func NoOpEventGen(_, _ string) bool { return false } -func NoOpRedirectFn(_ http.ResponseWriter, _ *http.Request) bool { +func NoOpRedirectFn(_ http.ResponseWriter, _ *http.Request, _, _ string) bool { return false } diff --git a/runtime/gateway_test.go b/runtime/gateway_test.go index db5d61a5c..fdc6b289e 100644 --- a/runtime/gateway_test.go +++ b/runtime/gateway_test.go @@ -391,7 +391,7 @@ func TestGatewayWithRedirectHandler(t *testing.T) { }) t.Run("with redirect handler", func(t *testing.T) { - redirectFn := func(_ http.ResponseWriter, _ *http.Request) bool { + redirectFn := func(_ http.ResponseWriter, _ *http.Request, _, _ string) bool { return false } opts.RedirectProvider = func(gateway *Gateway) RedirectFn { diff --git a/runtime/router.go b/runtime/router.go index dbd4eeb9e..24361f635 100644 --- a/runtime/router.go +++ b/runtime/router.go @@ -143,7 +143,7 @@ func (endpoint *RouterEndpoint) HandleRequest( // defer cancel() //} - if isRedirected := endpoint.redirectFn(w, r); isRedirected { + if isRedirected := endpoint.redirectFn(w, r, endpoint.EndpointName, endpoint.HandlerName); isRedirected { return }