From 41a0d77e482abe8af78e145e7462f152336038a0 Mon Sep 17 00:00:00 2001 From: Nathan Coleman Date: Fri, 9 Jun 2023 20:56:53 -0400 Subject: [PATCH] Add header filter to api-gateway xDS golden test --- agent/xds/resources_test.go | 13 ++++++ ...route-and-inline-certificate.latest.golden | 40 ++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/agent/xds/resources_test.go b/agent/xds/resources_test.go index 4687c4a7d6..29743c060b 100644 --- a/agent/xds/resources_test.go +++ b/agent/xds/resources_test.go @@ -415,6 +415,19 @@ func getAPIGatewayGoldenTestCases(t *testing.T) []goldenTestCase { Kind: structs.HTTPRoute, Name: "route", Rules: []structs.HTTPRouteRule{{ + Filters: structs.HTTPFilters{ + Headers: []structs.HTTPHeaderFilter{ + { + Add: map[string]string{ + "X-Header-Add": "added", + }, + Set: map[string]string{ + "X-Header-Set": "set", + }, + Remove: []string{"X-Header-Remove"}, + }, + }, + }, Services: []structs.HTTPService{{ Name: "service", }}, diff --git a/agent/xds/testdata/routes/api-gateway-with-http-route-and-inline-certificate.latest.golden b/agent/xds/testdata/routes/api-gateway-with-http-route-and-inline-certificate.latest.golden index 6abc6f2946..64e7f62282 100644 --- a/agent/xds/testdata/routes/api-gateway-with-http-route-and-inline-certificate.latest.golden +++ b/agent/xds/testdata/routes/api-gateway-with-http-route-and-inline-certificate.latest.golden @@ -18,8 +18,46 @@ }, "route": { "cluster": "service.default.dc1.internal.11111111-2222-3333-4444-555555555555.consul" - } + }, + "requestHeadersToAdd": [ + { + "header": { + "key": "X-Header-Add", + "value": "added" + }, + "append": true + }, + { + "header": { + "key": "X-Header-Set", + "value": "set" + }, + "append": false + } + ], + "requestHeadersToRemove": [ + "X-Header-Remove" + ] + } + ], + "requestHeadersToAdd": [ + { + "header": { + "key": "X-Header-Add", + "value": "added" + }, + "append": true + }, + { + "header": { + "key": "X-Header-Set", + "value": "set" + }, + "append": false } + ], + "requestHeadersToRemove": [ + "X-Header-Remove" ] } ],