diff --git a/pkg/routes/api/v2/notifications.go b/pkg/routes/api/v2/notifications.go index c1c91b8ce..d5e5b67d3 100644 --- a/pkg/routes/api/v2/notifications.go +++ b/pkg/routes/api/v2/notifications.go @@ -71,7 +71,9 @@ func RegisterNotificationRoutes(api huma.API) { Description: "Marks every notification of the authenticated user as read. Link shares have no notifications and are refused.", Method: http.MethodPost, Path: "/notifications", - Tags: tags, + // Override the wrapper's POST→201 create default: this action creates nothing. + DefaultStatus: http.StatusOK, + Tags: tags, }, notificationsMarkAllRead) } diff --git a/pkg/webtests/huma_notification_test.go b/pkg/webtests/huma_notification_test.go index 02be04e89..59d07e5c0 100644 --- a/pkg/webtests/huma_notification_test.go +++ b/pkg/webtests/huma_notification_test.go @@ -93,7 +93,8 @@ func TestHumaNotification_MarkAllAsRead(t *testing.T) { token := humaTokenFor(t, &testuser1) rec := humaRequest(t, e, http.MethodPost, "/api/v2/notifications", "", token, "") - require.Equal(t, http.StatusCreated, rec.Code, "body: %s", rec.Body.String()) + // 200, not the wrapper's POST default 201: mark-all creates nothing. + require.Equal(t, http.StatusOK, rec.Code, "body: %s", rec.Body.String()) assert.Contains(t, rec.Body.String(), `"message":"success"`) list := humaRequest(t, e, http.MethodGet, "/api/v2/notifications", "", token, "")