-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NET-5530 Support response header modifiers on http-route config entry #18646
Changes from all commits
e04827a
3e52aeb
53e6a0b
aefe5b0
d63604b
7e8c11a
234eca1
8560ed5
91b5821
3908dd6
1f295d4
264e198
1ec6cb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:feature | ||
api-gateway: Add support for response header modifiers on http-route configuration entry | ||
``` |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changes in this test:
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -518,8 +518,70 @@ func TestGatewayChainSynthesizer_Synthesize(t *testing.T) { | |
Kind: structs.HTTPRoute, | ||
Name: "http-route", | ||
Rules: []structs.HTTPRouteRule{{ | ||
Filters: structs.HTTPFilters{ | ||
Headers: []structs.HTTPHeaderFilter{ | ||
{ | ||
Add: map[string]string{"add me to the rule request": "present"}, | ||
Set: map[string]string{"set me on the rule request": "present"}, | ||
Remove: []string{"remove me from the rule request"}, | ||
}, | ||
{ | ||
Add: map[string]string{"add me to the rule and service request": "rule"}, | ||
Set: map[string]string{"set me on the rule and service request": "rule"}, | ||
}, | ||
{ | ||
Remove: []string{"remove me from the rule and service request"}, | ||
}, | ||
}, | ||
}, | ||
ResponseFilters: structs.HTTPResponseFilters{ | ||
Headers: []structs.HTTPHeaderFilter{{ | ||
Add: map[string]string{ | ||
"add me to the rule response": "present", | ||
"add me to the rule and service response": "rule", | ||
}, | ||
Set: map[string]string{ | ||
"set me on the rule response": "present", | ||
"set me on the rule and service response": "rule", | ||
}, | ||
Remove: []string{ | ||
"remove me from the rule response", | ||
"remove me from the rule and service response", | ||
}, | ||
}}, | ||
}, | ||
Services: []structs.HTTPService{{ | ||
Name: "foo", | ||
Filters: structs.HTTPFilters{ | ||
Headers: []structs.HTTPHeaderFilter{ | ||
{ | ||
Add: map[string]string{"add me to the service request": "present"}, | ||
}, | ||
{ | ||
Set: map[string]string{"set me on the service request": "present"}, | ||
Remove: []string{"remove me from the service request"}, | ||
}, | ||
{ | ||
Add: map[string]string{"add me to the rule and service request": "service"}, | ||
Set: map[string]string{"set me on the rule and service request": "service"}, | ||
Remove: []string{"remove me from the rule and service request"}, | ||
}, | ||
}, | ||
}, | ||
ResponseFilters: structs.HTTPResponseFilters{ | ||
Headers: []structs.HTTPHeaderFilter{ | ||
{ | ||
Add: map[string]string{"add me to the service response": "present"}, | ||
Set: map[string]string{"set me on the service response": "present"}, | ||
Remove: []string{"remove me from the service response"}, | ||
}, | ||
{ | ||
Add: map[string]string{"add me to the rule and service response": "service"}, | ||
Set: map[string]string{"set me on the rule and service response": "service"}, | ||
Remove: []string{"remove me from the rule and service response"}, | ||
}, | ||
}, | ||
}, | ||
}}, | ||
}}, | ||
}, | ||
|
@@ -557,8 +619,40 @@ func TestGatewayChainSynthesizer_Synthesize(t *testing.T) { | |
Partition: "default", | ||
Namespace: "default", | ||
RequestHeaders: &structs.HTTPHeaderModifiers{ | ||
Add: make(map[string]string), | ||
Set: make(map[string]string), | ||
Add: map[string]string{ | ||
"add me to the rule request": "present", | ||
"add me to the service request": "present", | ||
"add me to the rule and service request": "service", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we expect this pattern applies to the other modifiers below as well. |
||
}, | ||
Set: map[string]string{ | ||
"set me on the rule request": "present", | ||
"set me on the service request": "present", | ||
"set me on the rule and service request": "service", | ||
}, | ||
Remove: []string{ | ||
"remove me from the rule request", | ||
"remove me from the rule and service request", | ||
"remove me from the service request", | ||
"remove me from the rule and service request", | ||
}, | ||
}, | ||
ResponseHeaders: &structs.HTTPHeaderModifiers{ | ||
Add: map[string]string{ | ||
"add me to the rule response": "present", | ||
"add me to the service response": "present", | ||
"add me to the rule and service response": "service", | ||
}, | ||
Set: map[string]string{ | ||
"set me on the rule response": "present", | ||
"set me on the service response": "present", | ||
"set me on the rule and service response": "service", | ||
}, | ||
Remove: []string{ | ||
"remove me from the rule response", | ||
"remove me from the rule and service response", | ||
"remove me from the service response", | ||
"remove me from the rule and service response", | ||
}, | ||
}, | ||
}, | ||
}, | ||
|
@@ -663,6 +757,10 @@ func TestGatewayChainSynthesizer_Synthesize(t *testing.T) { | |
Add: make(map[string]string), | ||
Set: make(map[string]string), | ||
}, | ||
ResponseHeaders: &structs.HTTPHeaderModifiers{ | ||
Add: make(map[string]string), | ||
Set: make(map[string]string), | ||
}, | ||
}, | ||
}, | ||
NextNode: "resolver:foo-2.default.default.dc2", | ||
|
@@ -850,6 +948,10 @@ func TestGatewayChainSynthesizer_ComplexChain(t *testing.T) { | |
Add: make(map[string]string), | ||
Set: make(map[string]string), | ||
}, | ||
ResponseHeaders: &structs.HTTPHeaderModifiers{ | ||
Add: make(map[string]string), | ||
Set: make(map[string]string), | ||
}, | ||
}, | ||
}, | ||
NextNode: "splitter:splitter-one.default.default", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this out as pre-existing behavior. I considered doing a merge of the
Remove
lists but did not want to introduce that as a side effect of this PR