diff --git a/http/handler.go b/http/handler.go index 59a3c3162..9b65fe257 100644 --- a/http/handler.go +++ b/http/handler.go @@ -2721,6 +2721,9 @@ func (h *Handler) handlePostImport(w http.ResponseWriter, r *http.Request) { qcx := h.api.Txf().NewQcx() defer qcx.Abort() + if isImportRequestEmpty(req) { + return + } if err := h.api.ImportValue(r.Context(), qcx, req, opts...); err != nil { switch errors.Cause(err) { case pilosa.ErrClusterDoesNotOwnShard, pilosa.ErrPreconditionFailed: @@ -3463,3 +3466,8 @@ func (h *Handler) handlePostRestore(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) w.Write([]byte("OK")) //nolint:errcheck } + +func isImportRequestEmpty(req *pilosa.ImportValueRequest) bool { + totalData := len(req.Values) + len(req.FloatValues) + len(req.TimestampValues) + len(req.StringValues) + return totalData == 0 +}