Skip to content

Commit

Permalink
Merge pull request #1 from JleMyP/master
Browse files Browse the repository at this point in the history
fix empty body check
  • Loading branch information
assemmarwan authored Feb 6, 2021
2 parents 80e64a5 + 20ec72b commit 9811205
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/src/dio_http_formatter_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ class HttpFormatter extends Interceptor {
}
}

if (_includeRequestBody && requestOptions.data != null) {
if (_includeRequestBody &&
requestOptions.data != null &&
requestOptions.data.isNotEmpty) {
requestString +=
'\n\n' + _getBody(requestOptions.data, requestOptions.contentType);
}
Expand All @@ -124,7 +126,9 @@ class HttpFormatter extends Interceptor {
}
}

if (_includeResponseBody && response.data != null) {
if (_includeResponseBody &&
response.data != null &&
response.data.isNotEmpty) {
responseString += '\n\n' +
_getBody(response.data, response.headers.value('content-type'));
}
Expand Down

0 comments on commit 9811205

Please sign in to comment.