| 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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A utility for retrieving data from a URL. | 8 * A utility for retrieving data from a URL. |
| 9 * | 9 * |
| 10 * HttpRequest can be used to obtain data from http, ftp, and file | 10 * HttpRequest can be used to obtain data from http, ftp, and file |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 requestHeaders.putIfAbsent('Content-Type', | 80 requestHeaders.putIfAbsent('Content-Type', |
| 81 () => 'application/x-www-form-urlencoded; charset=UTF-8'); | 81 () => 'application/x-www-form-urlencoded; charset=UTF-8'); |
| 82 | 82 |
| 83 return request(url, method: 'POST', withCredentials: withCredentials, | 83 return request(url, method: 'POST', withCredentials: withCredentials, |
| 84 responseType: responseType, | 84 responseType: responseType, |
| 85 requestHeaders: requestHeaders, sendData: formData, | 85 requestHeaders: requestHeaders, sendData: formData, |
| 86 onProgress: onProgress); | 86 onProgress: onProgress); |
| 87 } | 87 } |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * Creates a URL request for the specified [url]. | 90 * Creates and sends a URL request for the specified [url]. |
| 91 * | 91 * |
| 92 * By default `request` will perform an HTTP GET request, but a different | 92 * By default `request` will perform an HTTP GET request, but a different |
| 93 * method (`POST`, `PUT`, `DELETE`, etc) can be used by specifying the | 93 * method (`POST`, `PUT`, `DELETE`, etc) can be used by specifying the |
| 94 * [method] parameter. | 94 * [method] parameter. |
| 95 * | 95 * |
| 96 * The Future is completed when the response is available. | 96 * The Future is completed when the response is available. |
| 97 * | 97 * |
| 98 * If specified, `sendData` will send data in the form of a [ByteBuffer], | 98 * If specified, `sendData` will send data in the form of a [ByteBuffer], |
| 99 * [Blob], [Document], [String], or [FormData] along with the HttpRequest. | 99 * [Blob], [Document], [String], or [FormData] along with the HttpRequest. |
| 100 * | 100 * |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } else { | 267 } else { |
| 268 JS('', '#.send()', xhr); | 268 JS('', '#.send()', xhr); |
| 269 } | 269 } |
| 270 | 270 |
| 271 return completer.future; | 271 return completer.future; |
| 272 $endif | 272 $endif |
| 273 } | 273 } |
| 274 | 274 |
| 275 $!MEMBERS | 275 $!MEMBERS |
| 276 } | 276 } |
| OLD | NEW |