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

Unified Diff: tests/html/xhr_test.dart

Issue 22227003: Adding HttpRequest method to make it easier to post form data. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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:
View side-by-side diff with in-line comments
Download patch
Index: tests/html/xhr_test.dart
diff --git a/tests/html/xhr_test.dart b/tests/html/xhr_test.dart
index 7c2f863519a39c3b50580b55af69785904ac89be..d47707f7497bcbce4bef1ec1c7f739a006205bc7 100644
--- a/tests/html/xhr_test.dart
+++ b/tests/html/xhr_test.dart
@@ -208,6 +208,24 @@ main() {
});
});
}
+
+ test('xhr postFormData', () {
+ var data = { 'name': 'John', 'time': '2 pm' };
+
+ var parts = [];
+ for (var key in data.keys) {
+ parts.add('${Uri.encodeQueryComponent(key)}='
+ '${Uri.encodeQueryComponent(data[key])}');
+ }
+ var encodedData = parts.join('&');
+
+ return HttpRequest.postFormData(
+ '${window.location.protocol}//${window.location.host}/echo', data)
+ .then((xhr) {
+ expect(xhr.responseText, encodedData);
+ });
+ });
+
});
group('xhr_requestBlob', () {
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.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