OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library http.test.html.streamed_request_test; | 5 library http.test.html.streamed_request_test; |
6 | 6 |
7 import 'dart:convert'; | |
8 | |
9 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
10 import 'package:http/browser_client.dart'; | 8 import 'package:http/browser_client.dart'; |
11 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
12 | 10 |
13 import 'utils.dart'; | 11 import 'utils.dart'; |
14 | 12 |
15 void main() { | 13 void main() { |
16 group('contentLength', () { | 14 group('contentLength', () { |
17 test("works when it's set", () { | 15 test("works when it's set", () { |
18 var request = new http.StreamedRequest('POST', echoUrl); | 16 var request = new http.StreamedRequest('POST', echoUrl); |
(...skipping 11 matching lines...) Expand all Loading... |
30 var request = new http.StreamedRequest('POST', echoUrl); | 28 var request = new http.StreamedRequest('POST', echoUrl); |
31 request.sink.add([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); | 29 request.sink.add([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
32 request.sink.close(); | 30 request.sink.close(); |
33 | 31 |
34 return new BrowserClient().send(request).then((response) { | 32 return new BrowserClient().send(request).then((response) { |
35 expect(response.stream.toBytes(), | 33 expect(response.stream.toBytes(), |
36 completion(equals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))); | 34 completion(equals([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))); |
37 }); | 35 }); |
38 }); | 36 }); |
39 }); | 37 }); |
40 } | 38 } |
OLD | NEW |