| 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 client; | 5 library client; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:typed_data'; | 9 import 'dart:typed_data'; |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 /// Sends an HTTP DELETE request with the given headers to the given URL, | 85 /// Sends an HTTP DELETE request with the given headers to the given URL, |
| 86 /// which can be a [Uri] or a [String]. | 86 /// which can be a [Uri] or a [String]. |
| 87 /// | 87 /// |
| 88 /// For more fine-grained control over the request, use [send] instead. | 88 /// For more fine-grained control over the request, use [send] instead. |
| 89 Future<Response> delete(url, {Map<String, String> headers}); | 89 Future<Response> delete(url, {Map<String, String> headers}); |
| 90 | 90 |
| 91 /// Sends an HTTP GET request with the given headers to the given URL, which | 91 /// Sends an HTTP GET request with the given headers to the given URL, which |
| 92 /// can be a [Uri] or a [String], and returns a Future that completes to the | 92 /// can be a [Uri] or a [String], and returns a Future that completes to the |
| 93 /// body of the response as a String. | 93 /// body of the response as a String. |
| 94 /// | 94 /// |
| 95 /// The Future will emit an [HttpException] if the response doesn't have a | 95 /// The Future will emit a [ClientException] if the response doesn't have a |
| 96 /// success status code. | 96 /// success status code. |
| 97 /// | 97 /// |
| 98 /// For more fine-grained control over the request and response, use [send] or | 98 /// For more fine-grained control over the request and response, use [send] or |
| 99 /// [get] instead. | 99 /// [get] instead. |
| 100 Future<String> read(url, {Map<String, String> headers}); | 100 Future<String> read(url, {Map<String, String> headers}); |
| 101 | 101 |
| 102 /// Sends an HTTP GET request with the given headers to the given URL, which | 102 /// Sends an HTTP GET request with the given headers to the given URL, which |
| 103 /// can be a [Uri] or a [String], and returns a Future that completes to the | 103 /// can be a [Uri] or a [String], and returns a Future that completes to the |
| 104 /// body of the response as a list of bytes. | 104 /// body of the response as a list of bytes. |
| 105 /// | 105 /// |
| 106 /// The Future will emit an [HttpException] if the response doesn't have a | 106 /// The Future will emit a [ClientException] if the response doesn't have a |
| 107 /// success status code. | 107 /// success status code. |
| 108 /// | 108 /// |
| 109 /// For more fine-grained control over the request and response, use [send] or | 109 /// For more fine-grained control over the request and response, use [send] or |
| 110 /// [get] instead. | 110 /// [get] instead. |
| 111 Future<Uint8List> readBytes(url, {Map<String, String> headers}); | 111 Future<Uint8List> readBytes(url, {Map<String, String> headers}); |
| 112 | 112 |
| 113 /// Sends an HTTP request and asynchronously returns the response. | 113 /// Sends an HTTP request and asynchronously returns the response. |
| 114 Future<StreamedResponse> send(BaseRequest request); | 114 Future<StreamedResponse> send(BaseRequest request); |
| 115 | 115 |
| 116 /// Closes the client and cleans up any resources associated with it. It's | 116 /// Closes the client and cleans up any resources associated with it. It's |
| 117 /// important to close each client when it's done being used; failing to do so | 117 /// important to close each client when it's done being used; failing to do so |
| 118 /// can cause the Dart process to hang. | 118 /// can cause the Dart process to hang. |
| 119 void close(); | 119 void close(); |
| 120 } | 120 } |
| OLD | NEW |