mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 07:54:22 +00:00
Replace interface{} with any
This commit is contained in:
@@ -308,7 +308,7 @@ func (h *Handler) AdminUpdateUser() http.HandlerFunc {
|
||||
}
|
||||
|
||||
// Track what's being updated for logging
|
||||
updates := make(map[string]interface{})
|
||||
updates := make(map[string]any)
|
||||
|
||||
if req.Email != "" {
|
||||
user.Email = req.Email
|
||||
|
||||
@@ -192,7 +192,7 @@ func TestFileHandlers_Integration(t *testing.T) {
|
||||
name string
|
||||
method string
|
||||
path string
|
||||
body interface{}
|
||||
body any
|
||||
}{
|
||||
{"list files", http.MethodGet, baseURL, nil},
|
||||
{"get file", http.MethodGet, baseURL + "/test.md", nil},
|
||||
|
||||
@@ -123,7 +123,7 @@ func TestGitHandlers_Integration(t *testing.T) {
|
||||
name string
|
||||
method string
|
||||
path string
|
||||
body interface{}
|
||||
body any
|
||||
}{
|
||||
{
|
||||
name: "commit without token",
|
||||
|
||||
@@ -37,7 +37,7 @@ func NewHandler(db db.Database, s storage.Manager) *Handler {
|
||||
}
|
||||
|
||||
// respondJSON is a helper to send JSON responses
|
||||
func respondJSON(w http.ResponseWriter, data interface{}) {
|
||||
func respondJSON(w http.ResponseWriter, data any) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
if err := json.NewEncoder(w).Encode(data); err != nil {
|
||||
respondError(w, "Failed to encode response", http.StatusInternalServerError)
|
||||
|
||||
@@ -195,7 +195,7 @@ func (h *testHarness) createTestUser(t *testing.T, email, password string, role
|
||||
}
|
||||
}
|
||||
|
||||
func (h *testHarness) newRequest(t *testing.T, method, path string, body interface{}) *http.Request {
|
||||
func (h *testHarness) newRequest(t *testing.T, method, path string, body any) *http.Request {
|
||||
t.Helper()
|
||||
|
||||
var reqBody []byte
|
||||
@@ -246,7 +246,7 @@ func (h *testHarness) addCSRFCookie(t *testing.T, req *http.Request) string {
|
||||
}
|
||||
|
||||
// makeRequest is the main helper for making JSON requests
|
||||
func (h *testHarness) makeRequest(t *testing.T, method, path string, body interface{}, testUser *testUser) *httptest.ResponseRecorder {
|
||||
func (h *testHarness) makeRequest(t *testing.T, method, path string, body any, testUser *testUser) *httptest.ResponseRecorder {
|
||||
t.Helper()
|
||||
|
||||
req := h.newRequest(t, method, path, body)
|
||||
|
||||
Reference in New Issue
Block a user