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

Side by Side Diff: pkg/http/test/streamed_request_test.dart

Issue 215533005: Fix a bug in [http.BaseRequest.send]'s content length handling. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/http/lib/src/base_request.dart ('k') | pkg/http/test/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « pkg/http/lib/src/base_request.dart ('k') | pkg/http/test/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698