Committed by
GitHub
Merge pull request #920 from eduardoflorence/get-connect-form-urlencoded
Body string for content-type application/x-www-form-urlencoded
Showing
1 changed file
with
4 additions
and
0 deletions
@@ -117,6 +117,10 @@ class GetHttpClient { | @@ -117,6 +117,10 @@ class GetHttpClient { | ||
117 | jsonString = '$paramName=${Uri.encodeQueryComponent(jsonString)}'; | 117 | jsonString = '$paramName=${Uri.encodeQueryComponent(jsonString)}'; |
118 | } | 118 | } |
119 | } | 119 | } |
120 | + } else if (body is String) { | ||
121 | + bodyBytes = utf8.encode(body); | ||
122 | + headers['content-length'] = bodyBytes.length.toString(); | ||
123 | + headers['content-type'] = contentType ?? defaultContentType; | ||
120 | } else if (body == null) { | 124 | } else if (body == null) { |
121 | headers['content-type'] = contentType ?? defaultContentType; | 125 | headers['content-type'] = contentType ?? defaultContentType; |
122 | headers['content-length'] = '0'; | 126 | headers['content-length'] = '0'; |
-
Please register or login to post a comment