diff --git a/clientapi/routing/sendevent.go b/clientapi/routing/sendevent.go index 0d80e3089..c5884e80b 100644 --- a/clientapi/routing/sendevent.go +++ b/clientapi/routing/sendevent.go @@ -278,8 +278,10 @@ func generateSendEvent( content := make(map[string]interface{}) if err = json.Unmarshal(e.Content(), &content); err != nil { util.GetLogger(ctx).WithError(err).Error("Cannot unmarshal the event content.") - resErr := jsonerror.InternalServerError() - return nil, &resErr + return nil, &util.JSONResponse{ + Code: http.StatusBadRequest, + JSON: jsonerror.BadJSON("Cannot unmarshal the event content."), + } } if content["replacement_room"] == e.RoomID() { return nil, &util.JSONResponse{