Skip to content

Commit 93aed3e

Browse files
committed
fix test error
1 parent 4f308dc commit 93aed3e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/dart/lib/client.dart.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ class Client {
9797
throw {{spec.title | caseUcfirst}}Exception(e.message);
9898
}
9999
if(responseType == ResponseType.bytes) {
100-
if(e.response!.headers['content-type'].contains('application/json')) {
100+
if(e.response!.headers['content-type']?.contains('application/json') ?? false) {
101101
final res = json.decode(utf8.decode(e.response!.data));
102102
throw {{spec.title | caseUcfirst}}Exception(res['message'],res['code'], res);
103103
} else {
104104
throw {{spec.title | caseUcfirst}}Exception(e.message);
105105
}
106106
}
107-
throw {{spec.title | caseUcfirst}}Exception(e.response.data['message'],e.response.data['code'], e.response.data);
107+
throw {{spec.title | caseUcfirst}}Exception(e.response?.data['message'],e.response?.data['code'], e.response?.data);
108108
} catch(e) {
109109
throw {{spec.title | caseUcfirst}}Exception(e.toString());
110110
}

0 commit comments

Comments
 (0)