mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-05-21 11:35:26 +00:00
fix(restheadspec): return 200 OK with empty body instead of 204 on zero results
Frontend clients are sensitive to 204 No Content responses; always return 200 with an empty array/object and rely on X-No-Data-Found header to signal absence of records. Also treat "change" as an alias for "update" in recursive CUD processing.
This commit is contained in:
@@ -2507,11 +2507,7 @@ func (h *Handler) sendResponseWithOptions(w common.ResponseWriter, data interfac
|
||||
data = h.normalizeResultArray(data)
|
||||
}
|
||||
|
||||
if dataLen == 0 {
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
} else {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
if err := w.WriteJSON(data); err != nil {
|
||||
logger.Error("Failed to write JSON response: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user