Skip to content

Commit

Permalink
add IDs in AddMock response
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Ratier committed Jan 31, 2024
1 parent a108dc2 commit 2a41d5f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/handlers/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}

Expand Down

0 comments on commit 2a41d5f

Please sign in to comment.