| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 streamed_request_test; | 5 library streamed_request_test; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 | 8 |
| 9 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 isNot(contains('content-length')))))); | 51 isNot(contains('content-length')))))); |
| 52 }).whenComplete(stopServer); | 52 }).whenComplete(stopServer); |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 test('is frozen by finalize()', () { | 55 test('is frozen by finalize()', () { |
| 56 var request = new http.StreamedRequest('POST', dummyUrl); | 56 var request = new http.StreamedRequest('POST', dummyUrl); |
| 57 request.finalize(); | 57 request.finalize(); |
| 58 expect(() => request.contentLength = 10, throwsStateError); | 58 expect(() => request.contentLength = 10, throwsStateError); |
| 59 }); | 59 }); |
| 60 }); | 60 }); |
| 61 |
| 62 // Regression test. |
| 63 test('.send() with a response with no content length', () { |
| 64 return startServer().then((_) { |
| 65 var request = new http.StreamedRequest( |
| 66 'GET', serverUrl.resolve('/no-content-length')); |
| 67 request.sink.close(); |
| 68 return request.send(); |
| 69 }).then((response) { |
| 70 expect(UTF8.decodeStream(response.stream), completion(equals('body'))); |
| 71 }).whenComplete(stopServer); |
| 72 }); |
| 73 |
| 61 } | 74 } |
| OLD | NEW |