OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
8 import 'package:http_parser/http_parser.dart'; | 8 import 'package:http_parser/http_parser.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 }); | 89 }); |
90 | 90 |
91 test('with a unicode field value', () { | 91 test('with a unicode field value', () { |
92 var request = new http.MultipartRequest('POST', dummyUrl); | 92 var request = new http.MultipartRequest('POST', dummyUrl); |
93 request.fields['field'] = 'vⱥlūe'; | 93 request.fields['field'] = 'vⱥlūe'; |
94 | 94 |
95 expect(request, bodyMatches(''' | 95 expect(request, bodyMatches(''' |
96 --{{boundary}} | 96 --{{boundary}} |
97 content-disposition: form-data; name="field" | 97 content-disposition: form-data; name="field" |
98 content-type: text/plain; charset=utf-8 | 98 content-type: text/plain; charset=utf-8 |
| 99 content-transfer-encoding: binary |
| 100 |
99 | 101 |
100 vⱥlūe | 102 vⱥlūe |
101 --{{boundary}}-- | 103 --{{boundary}}-- |
102 ''')); | 104 ''')); |
103 }); | 105 }); |
104 | 106 |
105 test('with a unicode filename', () { | 107 test('with a unicode filename', () { |
106 var request = new http.MultipartRequest('POST', dummyUrl); | 108 var request = new http.MultipartRequest('POST', dummyUrl); |
107 request.files.add(new http.MultipartFile.fromString('file', 'contents', | 109 request.files.add(new http.MultipartFile.fromString('file', 'contents', |
108 filename: 'fïlēname.txt')); | 110 filename: 'fïlēname.txt')); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 expect(request, bodyMatches(''' | 226 expect(request, bodyMatches(''' |
225 --{{boundary}} | 227 --{{boundary}} |
226 content-type: application/octet-stream | 228 content-type: application/octet-stream |
227 content-disposition: form-data; name="file" | 229 content-disposition: form-data; name="file" |
228 | 230 |
229 hello | 231 hello |
230 --{{boundary}}-- | 232 --{{boundary}}-- |
231 ''')); | 233 ''')); |
232 }); | 234 }); |
233 } | 235 } |
OLD | NEW |