diff --git a/pkg/restheadspec/handler.go b/pkg/restheadspec/handler.go index b1b4826..44f968c 100644 --- a/pkg/restheadspec/handler.go +++ b/pkg/restheadspec/handler.go @@ -2167,6 +2167,11 @@ func (h *Handler) sendFormattedResponse(w common.ResponseWriter, data interface{ if data == nil { data = map[string]interface{}{} httpStatus = http.StatusNoContent + } else { + dataLen := reflection.Len(data) + if dataLen == 0 { + httpStatus = http.StatusNoContent + } } if options.SingleRecordAsObject {