From 32a543bf4f063aba9e804e85acbdbe6e0c26ecf0 Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Fri, 6 Dec 2019 21:39:18 +0530 Subject: [PATCH] Fix incorrect campaign API response when there are no campaigns --- campaigns.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/campaigns.go b/campaigns.go index e28760b..1fd0849 100644 --- a/campaigns.go +++ b/campaigns.go @@ -90,8 +90,8 @@ func handleGetCampaigns(c echo.Context) error { return echo.NewHTTPError(http.StatusBadRequest, "Campaign not found.") } if len(out.Results) == 0 { - out.Results = make([]models.Campaign, 0) - return c.JSON(http.StatusOK, out) + out.Results = []models.Campaign{} + return c.JSON(http.StatusOK, okResp{out}) } for i := 0; i < len(out.Results); i++ {