Skip to content

Commit

Permalink
fix: don't try to decode an empty body (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinzent03 authored Sep 19, 2023
1 parent cd614c1 commit ec13c88
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/postgrest/lib/src/postgrest_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ class PostgrestBuilder<T, S> implements Future<T> {
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 {
Expand Down

0 comments on commit ec13c88

Please sign in to comment.