From cf8e8938beebd9575d65bd43db40cadf067ce382 Mon Sep 17 00:00:00 2001 From: Alex Luong Date: Thu, 26 Mar 2026 04:34:55 +0700 Subject: [PATCH] fix: return SuccessResponse from DELETE /destinations Change the destination delete handler to return `{ "success": true }` instead of the full destination object, matching the tenant delete behavior and the OpenAPI spec. Closes #705 Co-Authored-By: Claude Opus 4.6 (1M context) --- internal/apirouter/destination_handlers.go | 7 +------ internal/apirouter/destination_handlers_test.go | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/apirouter/destination_handlers.go b/internal/apirouter/destination_handlers.go index 6f88b459..1a5ecb2e 100644 --- a/internal/apirouter/destination_handlers.go +++ b/internal/apirouter/destination_handlers.go @@ -200,12 +200,7 @@ func (h *DestinationHandlers) Delete(c *gin.Context) { return } - display, err := h.displayer.Display(destination) - if err != nil { - AbortWithError(c, http.StatusInternalServerError, NewErrInternalServer(err)) - return - } - c.JSON(http.StatusOK, display) + c.JSON(http.StatusOK, gin.H{"success": true}) } func (h *DestinationHandlers) Disable(c *gin.Context) { diff --git a/internal/apirouter/destination_handlers_test.go b/internal/apirouter/destination_handlers_test.go index 27d08af0..fd8e0f11 100644 --- a/internal/apirouter/destination_handlers_test.go +++ b/internal/apirouter/destination_handlers_test.go @@ -339,6 +339,10 @@ func TestAPI_Destinations(t *testing.T) { require.Equal(t, http.StatusOK, resp.Code) + var body map[string]any + require.NoError(t, json.Unmarshal(resp.Body.Bytes(), &body)) + assert.Equal(t, true, body["success"]) + // Subsequent GET returns 404 req = httptest.NewRequest(http.MethodGet, "/api/v1/tenants/t1/destinations/d1", nil) resp = h.do(h.withAPIKey(req))