| 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 io_client; | 5 library io_client; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'base_client.dart'; | 9 import 'base_client.dart'; |
| 10 import 'base_request.dart'; | 10 import 'base_request.dart'; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 connection.onResponse = (response) { | 67 connection.onResponse = (response) { |
| 68 var headers = <String>{}; | 68 var headers = <String>{}; |
| 69 response.headers.forEach((key, value) => headers[key] = value); | 69 response.headers.forEach((key, value) => headers[key] = value); |
| 70 | 70 |
| 71 completer.complete(new StreamedResponse( | 71 completer.complete(new StreamedResponse( |
| 72 wrapInputStream(response.inputStream), | 72 wrapInputStream(response.inputStream), |
| 73 response.statusCode, | 73 response.statusCode, |
| 74 response.contentLength, | 74 response.contentLength, |
| 75 request: request, |
| 75 headers: headers, | 76 headers: headers, |
| 76 isRedirect: response.isRedirect, | 77 isRedirect: response.isRedirect, |
| 77 persistentConnection: response.persistentConnection, | 78 persistentConnection: response.persistentConnection, |
| 78 reasonPhrase: response.reasonPhrase)); | 79 reasonPhrase: response.reasonPhrase)); |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 return completer.future; | 82 return completer.future; |
| 82 } | 83 } |
| 83 | 84 |
| 84 /// Closes the client. This terminates all active connections. If a client | 85 /// Closes the client. This terminates all active connections. If a client |
| 85 /// remains unclosed, the Dart process may not terminate. | 86 /// remains unclosed, the Dart process may not terminate. |
| 86 void close() { | 87 void close() { |
| 87 if (_inner != null) _inner.shutdown(force: true); | 88 if (_inner != null) _inner.shutdown(force: true); |
| 88 _inner = null; | 89 _inner = null; |
| 89 } | 90 } |
| 90 } | 91 } |
| OLD | NEW |