Skip to content

Commit c821be7

Browse files
committed
chore: shifted encoding to prepareRequest
1 parent 5c996dc commit c821be7

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
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}; ${Uri.encodeFull(Platform.operatingSystemVersion)})',
46+
'user-agent' : '{{spec.title | caseUcfirst}}{{ language.name | caseUcfirst }}SDK/{{ sdk.version }} (${Platform.operatingSystem}; ${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] = Uri.encodeFull(value);
88+
_headers![key] = value;
8989
return this;
9090
}
9191

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ClientMixin {
6262
(request as http.Request).body = jsonEncode(params);
6363
}
6464

65-
request.headers.addAll(headers);
65+
request.headers.addAll(headers.map((key, value) => MapEntry(key, URI.encodeFull(value))));
6666
return request;
6767
}
6868

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] = Uri.encodeFull(value);
128+
_headers![key] = value;
129129

130130
return this;
131131
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ClientMixin {
6262
(request as http.Request).body = jsonEncode(params);
6363
}
6464

65-
request.headers.addAll(headers);
65+
request.headers.addAll(headers.map((key, value) => MapEntry(key, URI.encodeFull(value))));
6666
return request;
6767
}
6868

0 commit comments

Comments
 (0)