Index: sdk/lib/html/dart2js/html_dart2js.dart |
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart |
index 76a98309747aab37a866c49e3220584480db64da..0cf52e56c103e954a9d1f4a5373eaf4cfa460e19 100644 |
--- a/sdk/lib/html/dart2js/html_dart2js.dart |
+++ b/sdk/lib/html/dart2js/html_dart2js.dart |
@@ -12186,6 +12186,40 @@ class HttpRequest extends EventTarget native "XMLHttpRequest" { |
} |
/** |
+ * 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 |