Remove extra argument

This commit is contained in:
2024-12-07 23:16:12 +01:00
parent 5633406f5c
commit 2e1ccb45d6
7 changed files with 103 additions and 113 deletions

View File

@@ -241,16 +241,11 @@ func (h *testHarness) addAuthCookies(t *testing.T, req *http.Request, session *m
}
// makeRequest is the main helper for making JSON requests
func (h *testHarness) makeRequest(t *testing.T, method, path string, body interface{}, session *models.Session, headers map[string]string) *httptest.ResponseRecorder {
func (h *testHarness) makeRequest(t *testing.T, method, path string, body interface{}, session *models.Session) *httptest.ResponseRecorder {
t.Helper()
req := h.newRequest(t, method, path, body)
// Add custom headers
for k, v := range headers {
req.Header.Set(k, v)
}
if session != nil {
needsCSRF := method != http.MethodGet && method != http.MethodHead && method != http.MethodOptions
csrfToken := h.addAuthCookies(t, req, session, needsCSRF)
@@ -263,16 +258,11 @@ func (h *testHarness) makeRequest(t *testing.T, method, path string, body interf
}
// makeRequestRawWithHeaders adds support for custom headers with raw body
func (h *testHarness) makeRequestRaw(t *testing.T, method, path string, body io.Reader, session *models.Session, headers map[string]string) *httptest.ResponseRecorder {
func (h *testHarness) makeRequestRaw(t *testing.T, method, path string, body io.Reader, session *models.Session) *httptest.ResponseRecorder {
t.Helper()
req := h.newRequestRaw(t, method, path, body)
// Add custom headers
for k, v := range headers {
req.Header.Set(k, v)
}
if session != nil {
needsCSRF := method != http.MethodGet && method != http.MethodHead && method != http.MethodOptions
csrfToken := h.addAuthCookies(t, req, session, needsCSRF)