fix: improve test error handling with proper error checks

Co-authored-by: Wikid82 <176516789+Wikid82@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-17 12:58:02 +00:00
parent 36a8b408b8
commit 6718431bc4

View File

@@ -202,7 +202,8 @@ func TestAuthMiddleware_QueryParamFallback(t *testing.T) {
})
// Test that query param auth still works (deprecated fallback)
req, _ := http.NewRequest("GET", "/test?token="+token, http.NoBody)
req, err := http.NewRequest("GET", "/test?token="+token, http.NoBody)
require.NoError(t, err)
w := httptest.NewRecorder()
r.ServeHTTP(w, req)
@@ -230,7 +231,8 @@ func TestAuthMiddleware_PrefersCookieOverQueryParam(t *testing.T) {
})
// Both cookie and query param provided - cookie should win
req, _ := http.NewRequest("GET", "/test?token="+queryToken, http.NoBody)
req, err := http.NewRequest("GET", "/test?token="+queryToken, http.NoBody)
require.NoError(t, err)
req.AddCookie(&http.Cookie{Name: "auth_token", Value: cookieToken})
w := httptest.NewRecorder()
r.ServeHTTP(w, req)