Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfeistel <6742251-feistel@users.noreply.gitlab.com>2021-08-17 18:57:33 +0300
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2021-08-19 08:24:40 +0300
commit0036c260968d083e56e7336259e5464facb1dc73 (patch)
tree6a772cf3a6ba1bacf2478bd6573c97948c66d811 /internal/handlers
parent111faf403e3df4c6e998a625f7ad8b22da4ff6ee (diff)
test: fix response body not being closed
nolint is added when the body is nil or if the body can't be closed
Diffstat (limited to 'internal/handlers')
-rw-r--r--internal/handlers/handlers_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/handlers/handlers_test.go b/internal/handlers/handlers_test.go
index aa664266..3c14de35 100644
--- a/internal/handlers/handlers_test.go
+++ b/internal/handlers/handlers_test.go
@@ -79,6 +79,7 @@ func TestNotFoundWithTokenIsNotHandled(t *testing.T) {
reqURL, _ := url.Parse("/")
r := &http.Request{URL: reqURL}
response := &http.Response{StatusCode: http.StatusNotFound}
+ // nolint:bodyclose // FIXME
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, "token")(response)
require.False(t, handled)
@@ -97,6 +98,7 @@ func TestNotFoundWithoutTokenIsNotHandledWhenNotAuthSupport(t *testing.T) {
reqURL, _ := url.Parse("/")
r := &http.Request{URL: reqURL}
response := &http.Response{StatusCode: http.StatusNotFound}
+ // nolint:bodyclose // FIXME
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, "")(response)
require.False(t, handled)
@@ -115,6 +117,7 @@ func TestNotFoundWithoutTokenIsHandled(t *testing.T) {
reqURL, _ := url.Parse("/")
r := &http.Request{URL: reqURL}
response := &http.Response{StatusCode: http.StatusNotFound}
+ // nolint:bodyclose // FIXME
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, "")(response)
require.True(t, handled)
@@ -133,6 +136,7 @@ func TestInvalidTokenResponseIsHandled(t *testing.T) {
reqURL, _ := url.Parse("/")
r := &http.Request{URL: reqURL}
response := &http.Response{StatusCode: http.StatusUnauthorized}
+ // nolint:bodyclose // FIXME
handled := handlers.checkIfLoginRequiredOrInvalidToken(w, r, "token")(response)
require.True(t, handled)