Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions server/handlers/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,17 @@ func (a *Admin) AddMocks(c echo.Context) error {
}
}

// Return the target session (id + name) so callers — shell scripts especially — can chain a
// GET /mocks?session=<id> without a separate GET /sessions lookup. Session names are not a
// reliable key (they need not be unique); the opaque id is.
session, err := a.mocksServices.GetSessionByID(sessionID)
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
}

return c.JSON(http.StatusOK, echo.Map{
"message": "Mocks registered successfully",
"session": session.Summarize(),
})
}

Expand Down
3 changes: 3 additions & 0 deletions tests/features/set_mocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ testcases:
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.message ShouldEqual "Mocks registered successfully"
# POST /mocks returns the target session so callers can chain GET /mocks?session=<id>.
- result.bodyjson.session.id ShouldNotBeEmpty
- result.bodyjson.session.name ShouldNotBeEmpty

- type: http
method: GET
Expand Down
Loading