Skip to content

Commit

Permalink
Add test that combine Redirect and HeaderModifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Treenhan committed May 30, 2023
1 parent c8b54a0 commit f9c1a1d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
25 changes: 25 additions & 0 deletions conformance/tests/httproute-redirect-path.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,31 @@ var HTTPRouteRedirectPath = suite.ConformanceTest{
Path: "/replacement-full",
},
Namespace: ns,
}, {
Request: http.Request{
Path: "/full-path-and-header-modifiers",
UnfollowRedirect: true,
Headers: map[string]string{
"X-Header-Remove": "val",
},
},
Response: http.Response{
StatusCode: 301,
},
ExpectedRequest: &http.ExpectedRequest{
Request: http.Request{
Path: "/full-path-and-header-modifiers",
Headers: map[string]string{
"X-Header-Add": "add-appends-values",
"X-Header-Set": "set-overwrites-values",
},
},
AbsentHeaders: []string{"X-Header-Remove"},
},
RedirectRequest: &roundtripper.RedirectRequest{
Path: "/replacement-full",
},
Namespace: ns,
},
}
for i := range testCases {
Expand Down
21 changes: 21 additions & 0 deletions conformance/tests/httproute-redirect-path.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,24 @@ spec:
type: ReplaceFullPath
replaceFullPath: /replacement-full
statusCode: 301
- matches:
- path:
type: PathPrefix
value: /full-path-and-header-modifiers
filters:
- type: RequestHeaderModifier
requestHeaderModifier:
set:
- name: X-Header-Set
value: set-overwrites-values
add:
- name: X-Header-Add
value: add-appends-values
remove:
- X-Header-Remove
- type: RequestRedirect
requestRedirect:
path:
type: ReplaceFullPath
replaceFullPath: /replacement-full
statusCode: 301

0 comments on commit f9c1a1d

Please sign in to comment.