refactor(server/api/test): withUser helper; migrate 51 context-value sites (A3)
This commit is contained in:
@@ -19,7 +19,7 @@ import (
|
||||
func callEvents(h *handlers, user dbq.User, body []byte) *httptest.ResponseRecorder {
|
||||
req := httptest.NewRequest(http.MethodPost, "/api/events", bytes.NewReader(body))
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req = req.WithContext(context.WithValue(req.Context(), userCtxKeyForTest(), user))
|
||||
req = withUser(req, user)
|
||||
w := httptest.NewRecorder()
|
||||
h.handleEvents(w, req)
|
||||
return w
|
||||
|
||||
Reference in New Issue
Block a user