| 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 client-side XHR request for getting data from a URL, | 8 * A client-side XHR request for getting data from a URL, |
| 9 * formally known as XMLHttpRequest. | 9 * formally known as XMLHttpRequest. |
| 10 * | 10 * |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 * // Do something with the response. | 73 * // Do something with the response. |
| 74 * }); | 74 * }); |
| 75 * | 75 * |
| 76 * See also: | 76 * See also: |
| 77 * | 77 * |
| 78 * * [request] | 78 * * [request] |
| 79 */ | 79 */ |
| 80 static Future<String> getString(String url, | 80 static Future<String> getString(String url, |
| 81 {bool withCredentials, void onProgress(ProgressEvent e)}) { | 81 {bool withCredentials, void onProgress(ProgressEvent e)}) { |
| 82 return request(url, withCredentials: withCredentials, | 82 return request(url, withCredentials: withCredentials, |
| 83 onProgress: onProgress).then((xhr) => xhr.responseText); | 83 onProgress: onProgress).then((HttpRequest xhr) => xhr.responseText); |
| 84 } | 84 } |
| 85 | 85 |
| 86 /** | 86 /** |
| 87 * Makes a server POST request with the specified data encoded as form data. | 87 * Makes a server POST request with the specified data encoded as form data. |
| 88 * | 88 * |
| 89 * This is roughly the POST equivalent of getString. This method is similar | 89 * This is roughly the POST equivalent of getString. This method is similar |
| 90 * to sending a FormData object with broader browser support but limited to | 90 * to sending a FormData object with broader browser support but limited to |
| 91 * String values. | 91 * String values. |
| 92 * | 92 * |
| 93 * If [data] is supplied, the key/value pairs are URI encoded with | 93 * If [data] is supplied, the key/value pairs are URI encoded with |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 headers[key] = '${headers[key]}, $value'; | 371 headers[key] = '${headers[key]}, $value'; |
| 372 } else { | 372 } else { |
| 373 headers[key] = value; | 373 headers[key] = value; |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 return headers; | 376 return headers; |
| 377 } | 377 } |
| 378 | 378 |
| 379 $!MEMBERS | 379 $!MEMBERS |
| 380 } | 380 } |
| OLD | NEW |