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

Unified Diff: sdk/lib/html/dartium/html_dartium.dart

Side-by-side diff isn't available for this file because of its large size.
Issue 162113002: Additions to HttpRequest docs (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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:
Download patch
Index: sdk/lib/html/dartium/html_dartium.dart
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 9f5f8aba4244329ac8a8fec7f60cd18365c347fb..863bd311215bfcc0db2ffa9275ad9fe0ab46e1f2 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -15707,6 +15707,17 @@ class HttpRequest extends HttpRequestEventTarget {
* This is similar to [request] but specialized for HTTP GET requests which
* return text content.
*
+ * To add query parameters, append them to the [url] following a `?`,
+ * joining each key to its value with `=` and separating key-value pairs with
+ * `&`.
+ *
+ * var name = Uri.encodeQueryComponent('John');
+ * var id = Uri.encodeQueryComponent('42');
+ * HttpRequest.getString('users.json?name=$name&id=$id')
+ * .then((HttpRequest resp) {
+ * // Do something with the response.
+ * });
+ *
* See also:
*
* * [request]
@@ -15724,6 +15735,20 @@ class HttpRequest extends HttpRequestEventTarget {
* to sending a FormData object with broader browser support but limited to
* String values.
*
+ * If [data] is supplied, the key/value pairs are URI encoded with
+ * [Uri.encodeQueryComponent] and converted into an HTTP query string.
+ *
+ * Unless otherwise specified, this method appends the following header:
+ *
+ * Content-Type: application/x-www-form-urlencoded; charset=UTF-8
+ *
+ * Here's an example of using this method:
+ *
+ * var data = { 'firstName' : 'John', 'lastName' : 'Doe' };
+ * HttpRequest.postFormData('/send', data).then((HttpRequest resp) {
+ * // Do something with the response.
+ * });
+ *
* See also:
*
* * [request]
@@ -15775,6 +15800,24 @@ class HttpRequest extends HttpRequestEventTarget {
* * The `Access-Control-Allow-Credentials` header of `url` must be set to true.
* * If `Access-Control-Expose-Headers` has not been set to true, only a subset of all the response headers will be returned when calling [getAllRequestHeaders].
*
+ * The following is equivalent to the [getString] sample above:
+ *
+ * var name = Uri.encodeQueryComponent('John');
+ * var id = Uri.encodeQueryComponent('42');
+ * HttpRequest.request('users.json?name=$name&id=$id')
+ * .then((HttpRequest resp) {
+ * // Do something with the response.
+ * });
+ *
+ * Here's an example of submitting an entire form with [FormData].
+ *
+ * var myForm = querySelector('form#myForm');
+ * var data = new FormData(myForm);
+ * HttpRequest.request('/submit', method: 'POST', sendData: data)
+ * .then((HttpRequest resp) {
+ * // Do something with the response.
+ * });
+ *
* Note that requests for file:// URIs are only supported by Chrome extensions
* with appropriate permissions in their manifest. Requests to file:// URIs
* will also never fail- the Future will always complete successfully, even
@@ -28925,13 +28968,13 @@ class Url extends NativeFieldWrapperClass2 implements UrlUtils {
if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
return _createObjectURL_1(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
return _createObjectURL_2(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is MediaSource || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is _WebKitMediaSource || blob_OR_source_OR_stream == null)) {
return _createObjectURL_3(blob_OR_source_OR_stream);
}
- if ((blob_OR_source_OR_stream is _WebKitMediaSource || blob_OR_source_OR_stream == null)) {
+ if ((blob_OR_source_OR_stream is MediaStream || blob_OR_source_OR_stream == null)) {
return _createObjectURL_4(blob_OR_source_OR_stream);
}
throw new ArgumentError("Incorrect number or type of arguments");
« no previous file with comments | « sdk/lib/html/dart2js/html_dart2js.dart ('k') | tools/dom/templates/html/impl/impl_XMLHttpRequest.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698