aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Lundberg <emil@emlun.se>2023-07-26 23:33:45 +0200
committerGitHub <noreply@github.com>2023-07-26 21:33:45 +0000
commitb08b99e284ca1027608ded399802e42e2acc5180 (patch)
tree4fae5eacef20015909ee9bdee7b569e4f42cad09
parentf565df628c506f4cd07e2319af456db901a372c9 (diff)
downloadsyncthing-b08b99e284ca1027608ded399802e42e2acc5180.tar.gz
syncthing-b08b99e284ca1027608ded399802e42e2acc5180.zip
lib/api: Fix data race in TestCSRFRequired (#9006)
-rw-r--r--lib/api/api_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/api/api_test.go b/lib/api/api_test.go
index 89077c24c..78e3795ce 100644
--- a/lib/api/api_test.go
+++ b/lib/api/api_test.go
@@ -773,7 +773,7 @@ func TestCSRFRequired(t *testing.T) {
t.Run("/rest without a token should fail", func(t *testing.T) {
t.Parallel()
- resp, err = cli.Get(baseURL + "/rest/system/config")
+ resp, err := cli.Get(baseURL + "/rest/system/config")
if err != nil {
t.Fatal("Unexpected error from getting /rest/system/config:", err)
}
@@ -787,7 +787,7 @@ func TestCSRFRequired(t *testing.T) {
t.Parallel()
req, _ := http.NewRequest("GET", baseURL+"/rest/system/config", nil)
req.Header.Set("X-"+csrfTokenName, csrfTokenValue)
- resp, err = cli.Do(req)
+ resp, err := cli.Do(req)
if err != nil {
t.Fatal("Unexpected error from getting /rest/system/config:", err)
}
@@ -801,7 +801,7 @@ func TestCSRFRequired(t *testing.T) {
t.Parallel()
req, _ := http.NewRequest("GET", baseURL+"/rest/system/config", nil)
req.Header.Set("X-API-Key", testAPIKey+"X")
- resp, err = cli.Do(req)
+ resp, err := cli.Do(req)
if err != nil {
t.Fatal("Unexpected error from getting /rest/system/config:", err)
}
@@ -815,7 +815,7 @@ func TestCSRFRequired(t *testing.T) {
t.Parallel()
req, _ := http.NewRequest("GET", baseURL+"/rest/system/config", nil)
req.Header.Set("Authorization", "Bearer "+testAPIKey+"X")
- resp, err = cli.Do(req)
+ resp, err := cli.Do(req)
if err != nil {
t.Fatal("Unexpected error from getting /rest/system/config:", err)
}
@@ -829,7 +829,7 @@ func TestCSRFRequired(t *testing.T) {
t.Parallel()
req, _ := http.NewRequest("GET", baseURL+"/rest/system/config", nil)
req.Header.Set("X-API-Key", testAPIKey)
- resp, err = cli.Do(req)
+ resp, err := cli.Do(req)
if err != nil {
t.Fatal("Unexpected error from getting /rest/system/config:", err)
}
@@ -843,7 +843,7 @@ func TestCSRFRequired(t *testing.T) {
t.Parallel()
req, _ := http.NewRequest("GET", baseURL+"/rest/system/config", nil)
req.Header.Set("Authorization", "Bearer "+testAPIKey)
- resp, err = cli.Do(req)
+ resp, err := cli.Do(req)
if err != nil {
t.Fatal("Unexpected error from getting /rest/system/config:", err)
}