Skip to content

Commit 5c996dc

Browse files
committed
fix: uri encoding issues with user-agents in dart
1 parent 09bc721 commit 5c996dc

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

templates/dart/lib/src/client_io.dart.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ClientIO extends ClientBase with ClientMixin {
4343
'x-sdk-platform': '{{ sdk.platform }}',
4444
'x-sdk-language': '{{ language.name | caseLower }}',
4545
'x-sdk-version': '{{ sdk.version }}',
46-
'user-agent' : '{{spec.title | caseUcfirst}}{{ language.name | caseUcfirst }}SDK/{{ sdk.version }} (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
46+
'user-agent' : '{{spec.title | caseUcfirst}}{{ language.name | caseUcfirst }}SDK/{{ sdk.version }} (${Platform.operatingSystem}; ${Uri.encodeFull(Platform.operatingSystemVersion)})',
4747
{% for key,header in spec.global.defaultHeaders %}
4848
'{{key}}' : '{{header}}',
4949
{% endfor %}
@@ -85,7 +85,7 @@ class ClientIO extends ClientBase with ClientMixin {
8585

8686
@override
8787
ClientIO addHeader(String key, String value) {
88-
_headers![key] = value;
88+
_headers![key] = Uri.encodeFull(value);
8989
return this;
9090
}
9191

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class ClientIO extends ClientBase with ClientMixin {
125125

126126
@override
127127
ClientIO addHeader(String key, String value) {
128-
_headers![key] = value;
128+
_headers![key] = Uri.encodeFull(value);
129129

130130
return this;
131131
}

0 commit comments

Comments
 (0)