From d566c25d3997c59573de43ad92c7246c63a99c78 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 03:16:37 +0000 Subject: [PATCH 1/2] Initial plan From 8533e1d7d7ef9ebadffb55ce2cac45da09b290e0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 27 Feb 2026 03:20:14 +0000 Subject: [PATCH 2/2] Add middlewares field passthrough in pipeline HTTP trigger config wrapper Co-authored-by: intel352 <77607+intel352@users.noreply.github.com> --- plugins/http/plugin.go | 3 +++ plugins/http/plugin_test.go | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/plugins/http/plugin.go b/plugins/http/plugin.go index 5674ea69..eb427e5c 100644 --- a/plugins/http/plugin.go +++ b/plugins/http/plugin.go @@ -161,6 +161,9 @@ func (p *HTTPPlugin) PipelineTriggerConfigWrappers() map[string]plugin.TriggerCo if method, ok := cfg["method"]; ok { route["method"] = method } + if middlewares, ok := cfg["middlewares"]; ok { + route["middlewares"] = middlewares + } return map[string]any{ "routes": []any{route}, } diff --git a/plugins/http/plugin_test.go b/plugins/http/plugin_test.go index ac5d8a06..81d124e0 100644 --- a/plugins/http/plugin_test.go +++ b/plugins/http/plugin_test.go @@ -433,6 +433,58 @@ func TestStaticFileServerFactory_SPAConfigKey(t *testing.T) { } } +func TestPipelineTriggerConfigWrappers(t *testing.T) { + p := New() + wrappers := p.PipelineTriggerConfigWrappers() + wrapper, ok := wrappers["http"] + if !ok { + t.Fatal("missing pipeline trigger config wrapper for http") + } + + t.Run("forwards path, method, and middlewares", func(t *testing.T) { + cfg := map[string]any{ + "path": "/items", + "method": "GET", + "middlewares": []any{"auth-bearer", "rate-limit"}, + } + result := wrapper("list-items", cfg) + routes, ok := result["routes"].([]any) + if !ok || len(routes) != 1 { + t.Fatalf("expected 1 route, got %v", result["routes"]) + } + route := routes[0].(map[string]any) + if route["path"] != "/items" { + t.Errorf("path = %v, want /items", route["path"]) + } + if route["method"] != "GET" { + t.Errorf("method = %v, want GET", route["method"]) + } + mw, ok := route["middlewares"].([]any) + if !ok || len(mw) != 2 { + t.Fatalf("middlewares = %v, want [auth-bearer rate-limit]", route["middlewares"]) + } + if mw[0] != "auth-bearer" || mw[1] != "rate-limit" { + t.Errorf("middlewares = %v, want [auth-bearer rate-limit]", mw) + } + if route["workflow"] != "pipeline:list-items" { + t.Errorf("workflow = %v, want pipeline:list-items", route["workflow"]) + } + }) + + t.Run("omits middlewares when not set", func(t *testing.T) { + cfg := map[string]any{ + "path": "/items", + "method": "GET", + } + result := wrapper("list-items", cfg) + routes := result["routes"].([]any) + route := routes[0].(map[string]any) + if _, exists := route["middlewares"]; exists { + t.Error("middlewares key should not be present when not configured") + } + }) +} + func TestPluginLoaderIntegration(t *testing.T) { p := New()