Skip to content

Commit

Permalink
chore: simplified encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragAgg5k committed Feb 22, 2025
1 parent f23749f commit bb4f85e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions templates/dart/lib/src/client_mixin.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ class ClientMixin {
(request as http.Request).body = jsonEncode(params);
}

request.headers.addAll(Map.fromIterable(headers.entries,
key: (entry) => entry.key,
value: (entry) => entry.key == 'User-Agent' ? Uri.encodeFull(entry.value) : entry.value
));
headers['User-Agent'] = Uri.encodeFull(headers['User-Agent'] ?? '');

request.headers.addAll(headers);
return request;
}

Expand Down
7 changes: 3 additions & 4 deletions templates/flutter/lib/src/client_mixin.dart.twig
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ class ClientMixin {
(request as http.Request).body = jsonEncode(params);
}

request.headers.addAll(Map.fromIterable(headers.entries,
key: (entry) => entry.key,
value: (entry) => entry.key == 'User-Agent' ? Uri.encodeFull(entry.value) : entry.value
));
headers['User-Agent'] = Uri.encodeFull(headers['User-Agent'] ?? '');

request.headers.addAll(headers);
return request;
}

Expand Down

0 comments on commit bb4f85e

Please sign in to comment.