fix: update linter.
This commit is contained in:
parent
027d313df5
commit
29efac3e5e
52 changed files with 17 additions and 89 deletions
|
@ -179,16 +179,13 @@ func TestRedirectRegexHandler(t *testing.T) {
|
|||
handler.ServeHTTP(recorder, r)
|
||||
|
||||
assert.Equal(t, test.expectedStatus, recorder.Code)
|
||||
if test.expectedStatus == http.StatusMovedPermanently ||
|
||||
test.expectedStatus == http.StatusFound ||
|
||||
test.expectedStatus == http.StatusTemporaryRedirect ||
|
||||
test.expectedStatus == http.StatusPermanentRedirect {
|
||||
|
||||
switch test.expectedStatus {
|
||||
case http.StatusMovedPermanently, http.StatusFound, http.StatusTemporaryRedirect, http.StatusPermanentRedirect:
|
||||
location, err := recorder.Result().Location()
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, test.expectedURL, location.String())
|
||||
} else {
|
||||
default:
|
||||
location, err := recorder.Result().Location()
|
||||
require.Errorf(t, err, "Location %v", location)
|
||||
}
|
||||
|
|
|
@ -206,16 +206,14 @@ func TestRedirectSchemeHandler(t *testing.T) {
|
|||
handler.ServeHTTP(recorder, r)
|
||||
|
||||
assert.Equal(t, test.expectedStatus, recorder.Code)
|
||||
if test.expectedStatus == http.StatusMovedPermanently ||
|
||||
test.expectedStatus == http.StatusFound ||
|
||||
test.expectedStatus == http.StatusTemporaryRedirect ||
|
||||
test.expectedStatus == http.StatusPermanentRedirect {
|
||||
|
||||
switch test.expectedStatus {
|
||||
case http.StatusMovedPermanently, http.StatusFound, http.StatusTemporaryRedirect, http.StatusPermanentRedirect:
|
||||
location, err := recorder.Result().Location()
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, test.expectedURL, location.String())
|
||||
} else {
|
||||
default:
|
||||
location, err := recorder.Result().Location()
|
||||
require.Errorf(t, err, "Location %v", location)
|
||||
}
|
||||
|
@ -234,7 +232,6 @@ func TestRedirectSchemeHandler(t *testing.T) {
|
|||
test.expectedStatus == http.StatusFound ||
|
||||
test.expectedStatus == http.StatusTemporaryRedirect ||
|
||||
test.expectedStatus == http.StatusPermanentRedirect {
|
||||
|
||||
location, err := recorder.Result().Location()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue