Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: pkg/http/test/multipart_test.dart

Issue 23450003: Add encoding tests to pkg/http. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http/lib/src/utils.dart ('k') | pkg/http/test/request_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/test/multipart_test.dart
diff --git a/pkg/http/test/multipart_test.dart b/pkg/http/test/multipart_test.dart
index cdbb4cd361d85287903f4cf596456b4f4cd93df5..b59c8f97ae8d342e52427a7a4fa3fdda075259d0 100644
--- a/pkg/http/test/multipart_test.dart
+++ b/pkg/http/test/multipart_test.dart
@@ -145,11 +145,22 @@ void main() {
'''));
});
- // TODO(nweiz): test creating a multipart file with a charset other than UTF-8
- // once issue 6284 is fixed.
+ test('with a file with a iso-8859-1 body', () {
+ var request = new http.MultipartRequest('POST', dummyUrl);
+ // "Ã¥" encoded as ISO-8859-1 and then read as UTF-8 results in "å".
+ var file = new http.MultipartFile.fromString('file', 'non-ascii: "Ã¥"',
+ contentType: new ContentType('text', 'plain', charset: 'iso-8859-1'));
+ request.files.add(file);
- // TODO(nweiz): test creating a string with a unicode body once issue 6284 is
- // fixed.
+ expect(request, bodyMatches('''
+ --{{boundary}}
+ content-type: text/plain; charset=iso-8859-1
+ content-disposition: form-data; name="file"
+
+ non-ascii: "å"
+ --{{boundary}}--
+ '''));
+ });
test('with a stream file', () {
var request = new http.MultipartRequest('POST', dummyUrl);
« no previous file with comments | « pkg/http/lib/src/utils.dart ('k') | pkg/http/test/request_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698