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 3b3637e1510119d1792e321d327311790359ff96..ab63b3292c9e6b59ada09b292c949344f19ba97c 100644 |
--- a/sdk/lib/html/dartium/html_dartium.dart |
+++ b/sdk/lib/html/dartium/html_dartium.dart |
@@ -12631,6 +12631,40 @@ class HttpRequest extends EventTarget { |
} |
/** |
+ * Makes a server POST request with the specified data encoded as form data. |
+ * |
+ * This is similar to sending a FormData object with broader browser |
+ * support but limited to string values. |
+ * |
+ * See also: |
+ * |
+ * * [request] |
+ */ |
+ static Future<HttpRequest> postFormData(String url, Map<String, String> data, |
+ {bool withCredentials, String responseType, |
+ Map<String, String> requestHeaders, |
+ void onProgress(ProgressEvent e)}) { |
+ |
+ var parts = []; |
+ data.forEach((key, value) { |
+ parts.add('${Uri.encodeQueryComponent(key)}=' |
+ '${Uri.encodeQueryComponent(value)}'); |
+ }); |
+ var formData = parts.join('&'); |
+ |
+ if (requestHeaders == null) { |
+ requestHeaders = <String, String>{}; |
+ } |
+ requestHeaders.putIfAbsent('Content-Type', |
+ () => 'application/x-www-form-urlencoded; charset=UTF-8'); |
+ |
+ return request(url, method: 'POST', withCredentials: withCredentials, |
+ responseType: responseType, |
+ requestHeaders: requestHeaders, sendData: formData, |
+ onProgress: onProgress); |
+ } |
+ |
+ /** |
* Creates a URL request for the specified [url]. |
* |
* By default this will do an HTTP GET request, this can be overridden with |
@@ -32034,11 +32068,11 @@ class _Utils { |
static String addTrailingDot(String str) => '${str}.'; |
+ static bool isNoSuchMethodError(obj) => obj is NoSuchMethodError; |
+ |
// TODO(jacobr): we need a failsafe way to determine that a Node is really a |
// DOM node rather than just a class that extends Node. |
static bool isNode(obj) => obj is Node; |
- |
- static bool isNoSuchMethodError(obj) => obj is NoSuchMethodError; |
} |
class _NPObject extends NativeFieldWrapperClass1 { |