feat: fix some bugs.

This commit is contained in:
2022-01-18 18:58:18 +08:00
parent a088f857e8
commit c567122d84
5 changed files with 15 additions and 8 deletions
+2
View File
@@ -52,6 +52,8 @@ class Api {
if (builder is GetStatusCodeFunc) return builder({"statusCode": resp.statusCode});
T? res;
try {
if (resp.statusCode != HttpStatus.ok && resp.bodyBytes.length == 0)
throw HttpErrorCode(resp.statusCode, message: 'No resp body');
var decodeBody = json.decode(utf8.decode(resp.bodyBytes));
res = decodeBody is Map ? builder(decodeBody) : builder({'list': decodeBody});
} catch (e) {