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-27 08:39:31 +0300
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2021-09-09 06:07:22 +0300
commit9bc6df51b36a1e0f763b6ebc7974bb3d98aabf3a (patch)
tree28b88e9c3b6f2a16650164c15a28bfc62360763f /internal/auth
parent9dd40765e162aba80482abdf3ca8f788bec7a8db (diff)
refactor: move away from ioutil (deprecated)
Diffstat (limited to 'internal/auth')
-rw-r--r--internal/auth/auth_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go
index b49e5423..77ea0b7a 100644
--- a/internal/auth/auth_test.go
+++ b/internal/auth/auth_test.go
@@ -3,7 +3,7 @@ package auth
import (
"bytes"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"net/http/httptest"
"net/url"
@@ -301,7 +301,7 @@ func TestCheckAuthenticationWhenNoAccess(t *testing.T) {
require.Equal(t, http.StatusNotFound, res.StatusCode)
- body, err := ioutil.ReadAll(res.Body)
+ body, err := io.ReadAll(res.Body)
require.NoError(t, err)
require.Equal(t, string(body), "Generic 404")
}
@@ -471,7 +471,7 @@ func TestCheckResponseForInvalidTokenWhenInvalidToken(t *testing.T) {
require.NoError(t, err)
r := &http.Request{URL: reqURL, Host: "pages.gitlab-example.com", RequestURI: "/test"}
- resp := &http.Response{StatusCode: http.StatusUnauthorized, Body: ioutil.NopCloser(bytes.NewReader([]byte("{\"error\":\"invalid_token\"}")))}
+ resp := &http.Response{StatusCode: http.StatusUnauthorized, Body: io.NopCloser(bytes.NewReader([]byte("{\"error\":\"invalid_token\"}")))}
defer resp.Body.Close()
require.Equal(t, true, auth.CheckResponseForInvalidToken(result, r, resp))
@@ -489,7 +489,7 @@ func TestCheckResponseForInvalidTokenWhenNotInvalidToken(t *testing.T) {
require.NoError(t, err)
r := &http.Request{URL: reqURL}
- resp := &http.Response{StatusCode: http.StatusOK, Body: ioutil.NopCloser(bytes.NewReader([]byte("ok")))}
+ resp := &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader([]byte("ok")))}
require.Equal(t, false, auth.CheckResponseForInvalidToken(result, r, resp))
}