From 2a41d5f4d4b72759f770b1800a1cf5d481def45d Mon Sep 17 00:00:00 2001 From: Benjamin Ratier Date: Wed, 31 Jan 2024 14:37:04 +0100 Subject: [PATCH] add IDs in AddMock response --- server/handlers/admin.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/handlers/admin.go b/server/handlers/admin.go index 6807e6e..8f12aa0 100644 --- a/server/handlers/admin.go +++ b/server/handlers/admin.go @@ -71,14 +71,18 @@ func (a *Admin) AddMocks(c echo.Context) error { } } + IDs := make([]string, 0, len(mocks)) for _, mock := range mocks { - if _, err := a.mocksServices.AddMock(sessionID, mock); err != nil { + newMock, err := a.mocksServices.AddMock(sessionID, mock) + if err != nil { return echo.NewHTTPError(http.StatusNotFound, err.Error()) } + IDs = append(IDs, newMock.State.ID) } return c.JSON(http.StatusOK, echo.Map{ "message": "Mocks registered successfully", + "ids": IDs, }) }