Skip to content

Commit 4411659

Browse files
babakksCopilot
authored andcommitted
test(api): use tagged switch for gateway redirect routing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: eb7763a9-2086-461a-91a4-86ea4a2d078d
1 parent c728675 commit 4411659

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pkg/api/api_host_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ func newAPIHostTestHarness(t *testing.T, apiHost string) *apiHostTestHarness {
110110

111111
gateway := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
112112
harness.gatewayRequests.record(req)
113-
if req.URL.Path == "/redirect-to-third-party" {
113+
switch req.URL.Path {
114+
case "/redirect-to-third-party":
114115
http.Redirect(w, req, "https://"+thirdPartyHost+"/redirected", http.StatusFound)
115116
return
116-
} else if req.URL.Path == "/redirect-to-subdomain" {
117+
case "/redirect-to-subdomain":
117118
http.Redirect(w, req, "https://subdomain.gw.example.net/redirected", http.StatusFound)
118119
return
119120
}

0 commit comments

Comments
 (0)