Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: HunDunDM <hundundm@gmail.com>
  • Loading branch information
HunDunDM committed Jul 18, 2022
1 parent b948b96 commit 424fedf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/dashboard/adapter/redirector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ func (suite *redirectorTestSuite) TestReverseProxy() {

suite.redirector.SetAddress(suite.tempServer.URL)
// Test normal forwarding
req, err := http.NewRequest("GET", redirectorServer.URL, nil)
req, err := http.NewRequest(http.MethodGet, redirectorServer.URL, nil)
suite.NoError(err)
checkHTTPRequest(suite.Require(), suite.noRedirectHTTPClient, req, http.StatusOK, suite.tempText)
// Test the requests that are forwarded by others
req, err = http.NewRequest("GET", redirectorServer.URL, nil)
req, err = http.NewRequest(http.MethodGet, redirectorServer.URL, nil)
suite.NoError(err)
req.Header.Set(proxyHeader, "other")
checkHTTPRequest(suite.Require(), suite.noRedirectHTTPClient, req, http.StatusOK, suite.tempText)
// Test LoopDetected
suite.redirector.SetAddress(redirectorServer.URL)
req, err = http.NewRequest("GET", redirectorServer.URL, nil)
req, err = http.NewRequest(http.MethodGet, redirectorServer.URL, nil)
suite.NoError(err)
checkHTTPRequest(suite.Require(), suite.noRedirectHTTPClient, req, http.StatusLoopDetected, "")
}
Expand All @@ -90,11 +90,11 @@ func (suite *redirectorTestSuite) TestTemporaryRedirect() {
defer redirectorServer.Close()
suite.redirector.SetAddress(suite.tempServer.URL)
// Test TemporaryRedirect
req, err := http.NewRequest("GET", redirectorServer.URL, nil)
req, err := http.NewRequest(http.MethodGet, redirectorServer.URL, nil)
suite.NoError(err)
checkHTTPRequest(suite.Require(), suite.noRedirectHTTPClient, req, http.StatusTemporaryRedirect, "")
// Test Response
req, err = http.NewRequest("GET", redirectorServer.URL, nil)
req, err = http.NewRequest(http.MethodGet, redirectorServer.URL, nil)
suite.NoError(err)
checkHTTPRequest(suite.Require(), http.DefaultClient, req, http.StatusOK, suite.tempText)
}
Expand Down

0 comments on commit 424fedf

Please sign in to comment.