1
0
Fork 0

fix: update linter.

This commit is contained in:
Ludovic Fernandez 2019-09-26 11:00:06 +02:00 committed by Traefiker Bot
parent 027d313df5
commit 29efac3e5e
52 changed files with 17 additions and 89 deletions

View file

@ -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)
}

View file

@ -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)