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

Side by Side Diff: pkg/http/test/utils.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, 8 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/test/streamed_request_test.dart ('k') | no next file » | 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) 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 library test_utils; 5 library test_utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 if (path == '/redirect') { 49 if (path == '/redirect') {
50 response.statusCode = 302; 50 response.statusCode = 302;
51 response.headers.set('location', serverUrl.resolve('/').toString()); 51 response.headers.set('location', serverUrl.resolve('/').toString());
52 response.contentLength = 0; 52 response.contentLength = 0;
53 response.close(); 53 response.close();
54 return; 54 return;
55 } 55 }
56 56
57 if (path == '/no-content-length') {
58 response.statusCode = 200;
59 response.contentLength = -1;
60 response.write('body');
61 response.close();
62 return;
63 }
64
57 new ByteStream(request).toBytes().then((requestBodyBytes) { 65 new ByteStream(request).toBytes().then((requestBodyBytes) {
58 var outputEncoding; 66 var outputEncoding;
59 var encodingName = request.uri.queryParameters['response-encoding']; 67 var encodingName = request.uri.queryParameters['response-encoding'];
60 if (encodingName != null) { 68 if (encodingName != null) {
61 outputEncoding = requiredEncodingForCharset(encodingName); 69 outputEncoding = requiredEncodingForCharset(encodingName);
62 } else { 70 } else {
63 outputEncoding = ASCII; 71 outputEncoding = ASCII;
64 } 72 }
65 73
66 response.headers.contentType = 74 response.headers.contentType =
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 const isSocketException = const _SocketException(); 206 const isSocketException = const _SocketException();
199 207
200 /// A matcher for functions that throw SocketException. 208 /// A matcher for functions that throw SocketException.
201 const Matcher throwsSocketException = 209 const Matcher throwsSocketException =
202 const Throws(isSocketException); 210 const Throws(isSocketException);
203 211
204 class _SocketException extends TypeMatcher { 212 class _SocketException extends TypeMatcher {
205 const _SocketException() : super("SocketException"); 213 const _SocketException() : super("SocketException");
206 bool matches(item, Map matchState) => item is SocketException; 214 bool matches(item, Map matchState) => item is SocketException;
207 } 215 }
OLDNEW
« no previous file with comments | « pkg/http/test/streamed_request_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698