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

Side by Side Diff: pkg/http/lib/src/io_client.dart

Issue 14055003: Remove HttpClientRequest.response, as it's identical to HttpClientRequest.done. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « no previous file | sdk/lib/io/http.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 io_client; 5 library io_client;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'base_client.dart'; 10 import 'base_client.dart';
(...skipping 14 matching lines...) Expand all
25 var stream = request.finalize(); 25 var stream = request.finalize();
26 26
27 return _inner.openUrl(request.method, request.url).then((ioRequest) { 27 return _inner.openUrl(request.method, request.url).then((ioRequest) {
28 ioRequest.followRedirects = request.followRedirects; 28 ioRequest.followRedirects = request.followRedirects;
29 ioRequest.maxRedirects = request.maxRedirects; 29 ioRequest.maxRedirects = request.maxRedirects;
30 ioRequest.contentLength = request.contentLength; 30 ioRequest.contentLength = request.contentLength;
31 ioRequest.persistentConnection = request.persistentConnection; 31 ioRequest.persistentConnection = request.persistentConnection;
32 request.headers.forEach((name, value) { 32 request.headers.forEach((name, value) {
33 ioRequest.headers.set(name, value); 33 ioRequest.headers.set(name, value);
34 }); 34 });
35 return Future.wait([stream.pipe(ioRequest), ioRequest.response]) 35 return stream.pipe(ioRequest);
36 .then((list) => list[1]);
37 }).then((response) { 36 }).then((response) {
38 var headers = {}; 37 var headers = {};
39 response.headers.forEach((key, values) { 38 response.headers.forEach((key, values) {
40 headers[key] = values.join(','); 39 headers[key] = values.join(',');
41 }); 40 });
42 41
43 return new StreamedResponse( 42 return new StreamedResponse(
44 response, 43 response,
45 response.statusCode, 44 response.statusCode,
46 response.contentLength, 45 response.contentLength,
47 request: request, 46 request: request,
48 headers: headers, 47 headers: headers,
49 isRedirect: response.isRedirect, 48 isRedirect: response.isRedirect,
50 persistentConnection: response.persistentConnection, 49 persistentConnection: response.persistentConnection,
51 reasonPhrase: response.reasonPhrase); 50 reasonPhrase: response.reasonPhrase);
52 }); 51 });
53 } 52 }
54 53
55 /// Closes the client. This terminates all active connections. If a client 54 /// Closes the client. This terminates all active connections. If a client
56 /// remains unclosed, the Dart process may not terminate. 55 /// remains unclosed, the Dart process may not terminate.
57 void close() { 56 void close() {
58 if (_inner != null) _inner.close(force: true); 57 if (_inner != null) _inner.close(force: true);
59 _inner = null; 58 _inner = null;
60 } 59 }
61 } 60 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/io/http.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698