| Index: pkg/http/test/multipart_test.dart
|
| diff --git a/pkg/http/test/multipart_test.dart b/pkg/http/test/multipart_test.dart
|
| index 9c83ce1d43d13c0a75e576afc539a183b086fb9a..9ebcb834bce2927da70ee56f1f471cdd37a0984b 100644
|
| --- a/pkg/http/test/multipart_test.dart
|
| +++ b/pkg/http/test/multipart_test.dart
|
| @@ -8,6 +8,7 @@ import 'dart:async';
|
| import 'dart:io';
|
| import 'dart:utf';
|
|
|
| +import 'package:pathos/path.dart' as path;
|
| import 'package:unittest/unittest.dart';
|
| import 'package:http/http.dart' as http;
|
| import 'package:http/src/utils.dart';
|
| @@ -202,4 +203,26 @@ void main() {
|
| --{{boundary}}--
|
| '''));
|
| });
|
| +
|
| + test('with a file from disk', () {
|
| + var tempDir = new Directory('').createTempSync();
|
| +
|
| + expect(new Future.of(() {
|
| + var filePath = path.join(tempDir.path, 'test-file');
|
| + new File(filePath).writeAsStringSync('hello');
|
| + return http.MultipartFile.fromPath('file', filePath);
|
| + }).then((file) {
|
| + var request = new http.MultipartRequest('POST', dummyUrl);
|
| + request.files.add(file);
|
| +
|
| + expect(request, bodyMatches('''
|
| + --{{boundary}}
|
| + content-type: application/octet-stream
|
| + content-disposition: form-data; name="file"; filename="test-file"
|
| +
|
| + hello
|
| + --{{boundary}}--
|
| + '''));
|
| + }).whenComplete(() => tempDir.delete(recursive: true)), completes);
|
| + });
|
| }
|
|
|