diff --git a/packages/postgrest/lib/src/postgrest_builder.dart b/packages/postgrest/lib/src/postgrest_builder.dart index 892d47cf..2c8057ac 100644 --- a/packages/postgrest/lib/src/postgrest_builder.dart +++ b/packages/postgrest/lib/src/postgrest_builder.dart @@ -212,7 +212,9 @@ class PostgrestBuilder implements Future { int? count; if (response.request!.method != METHOD_HEAD) { - if (response.request!.headers['Accept'] == 'text/csv') { + if (response.bodyBytes.isEmpty) { + body = null; + } else if (response.request!.headers['Accept'] == 'text/csv') { body = response.body; } else { try {