From 74700cc8034980334e7df466f313287a41d2b8a6 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Mon, 27 Nov 2023 14:00:57 +0000 Subject: [performance] http response encoding / writing improvements (#2374) --- internal/api/client/notifications/notificationget.go | 2 +- internal/api/client/notifications/notificationsclear.go | 2 +- internal/api/client/notifications/notificationsget.go | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'internal/api/client/notifications') diff --git a/internal/api/client/notifications/notificationget.go b/internal/api/client/notifications/notificationget.go index 98e32498b..551eeca39 100644 --- a/internal/api/client/notifications/notificationget.go +++ b/internal/api/client/notifications/notificationget.go @@ -83,5 +83,5 @@ func (m *Module) NotificationGETHandler(c *gin.Context) { return } - c.JSON(http.StatusOK, resp) + apiutil.JSON(c, http.StatusOK, resp) } diff --git a/internal/api/client/notifications/notificationsclear.go b/internal/api/client/notifications/notificationsclear.go index 4b63db283..2d7da3c6b 100644 --- a/internal/api/client/notifications/notificationsclear.go +++ b/internal/api/client/notifications/notificationsclear.go @@ -75,5 +75,5 @@ func (m *Module) NotificationsClearPOSTHandler(c *gin.Context) { return } - c.JSON(http.StatusOK, struct{}{}) + apiutil.Data(c, http.StatusOK, apiutil.AppJSON, apiutil.EmptyJSONObject) } diff --git a/internal/api/client/notifications/notificationsget.go b/internal/api/client/notifications/notificationsget.go index fd175a115..da43cffec 100644 --- a/internal/api/client/notifications/notificationsget.go +++ b/internal/api/client/notifications/notificationsget.go @@ -155,5 +155,6 @@ func (m *Module) NotificationsGETHandler(c *gin.Context) { if resp.LinkHeader != "" { c.Header("Link", resp.LinkHeader) } - c.JSON(http.StatusOK, resp.Items) + + apiutil.JSON(c, http.StatusOK, resp.Items) } -- cgit v1.2.3