Skip to content

Commit d53866d

Browse files
committed
feat: warning dart & flutter
1 parent 1094b59 commit d53866d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

templates/dart/lib/src/client_mixin.dart.twig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ class ClientMixin {
6767

6868
Response prepareResponse(http.Response res, {ResponseType? responseType}) {
6969
responseType ??= ResponseType.json;
70+
71+
String? warnings = res.headers['x-{{ spec.title | lower }}-warning'];
72+
if (warnings != null) {
73+
warnings.split(';').forEach((warning) => print(warning));
74+
}
75+
7076
if (res.statusCode >= 400) {
7177
if ((res.headers['content-type'] ?? '').contains('application/json')) {
7278
final response = json.decode(res.body);

templates/flutter/lib/src/client_mixin.dart.twig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ class ClientMixin {
6767

6868
Response prepareResponse(http.Response res, {ResponseType? responseType}) {
6969
responseType ??= ResponseType.json;
70+
71+
String? warnings = res.headers['x-{{ spec.title | lower }}-warning'];
72+
if (warnings != null) {
73+
warnings.split(';').forEach((warning) => print(warning));
74+
}
75+
7076
if (res.statusCode >= 400) {
7177
if ((res.headers['content-type'] ?? '').contains('application/json')) {
7278
final response = json.decode(res.body);

0 commit comments

Comments
 (0)