From cb996783ca049ec99e39cd10c33bb804d5867dc9 Mon Sep 17 00:00:00 2001 From: Gergely Novak Date: Mon, 23 Sep 2024 11:46:49 +0200 Subject: [PATCH] Fix linter errors --- alpaca/rest_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/alpaca/rest_test.go b/alpaca/rest_test.go index 551b7ff..2a8afc6 100644 --- a/alpaca/rest_test.go +++ b/alpaca/rest_test.go @@ -45,7 +45,9 @@ func TestDefaultDo(t *testing.T) { func TestDefaultDo_BrokerAuth(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { authHeader := r.Header.Get("Authorization") - if assert.NotEmpty(t, authHeader) && assert.True(t, strings.HasPrefix(authHeader, "Basic "), "%s is not basic auth", authHeader) { + notEmpty := assert.NotEmpty(t, authHeader) + basicAuth := assert.True(t, strings.HasPrefix(authHeader, "Basic "), "%s is not basic auth", authHeader) + if notEmpty && basicAuth { key := authHeader[len("Basic "):] b, err := base64.URLEncoding.DecodeString(key) if assert.NoError(t, err) { @@ -61,7 +63,7 @@ func TestDefaultDo_BrokerAuth(t *testing.T) { BrokerSecret: "broker_secret", BaseURL: ts.URL, }) - req, err := http.NewRequest("GET", ts.URL+"/custompath", nil) + req, err := http.NewRequest(http.MethodGet, ts.URL+"/custompath", nil) require.NoError(t, err) resp, err := defaultDo(c, req) require.NoError(t, err)