Index: tests/html/xhr_test.dart |
diff --git a/tests/html/xhr_test.dart b/tests/html/xhr_test.dart |
index b5c538b890047c85cd14be2f9f1ca9f49b15b0d1..989488807a0dceea856de92e58b70aed610500d0 100644 |
--- a/tests/html/xhr_test.dart |
+++ b/tests/html/xhr_test.dart |
@@ -3,12 +3,12 @@ |
// BSD-style license that can be found in the LICENSE file. |
library XHRTest; |
-import '../../pkg/unittest/lib/unittest.dart'; |
-import '../../pkg/unittest/lib/html_individual_config.dart'; |
import 'dart:async'; |
+import 'dart:convert'; |
import 'dart:html'; |
-import "dart:convert"; |
import 'dart:typed_data'; |
+import 'package:unittest/html_individual_config.dart'; |
+import 'package:unittest/unittest.dart'; |
void fail(message) { |
guardAsync(() { |
@@ -225,7 +225,6 @@ main() { |
expect(xhr.responseText, encodedData); |
}); |
}); |
- |
}); |
group('xhr_requestBlob', () { |
@@ -241,4 +240,25 @@ main() { |
} |
}); |
}); |
+ |
+ group('json', () { |
+ test('xhr responseType json', () { |
+ var url = '${window.location.protocol}//${window.location.host}/echo'; |
+ var data = { |
+ 'key': 'value', |
+ 'a': 'b', |
+ 'one': 2, |
+ }; |
+ |
+ HttpRequest.request(url, |
+ method: 'POST', |
+ sendData: JSON.encode(data), |
+ responseType: 'json').then( |
+ expectAsync1((xhr) { |
+ expect(xhr.status, equals(200)); |
+ var json = xhr.response; |
+ expect(json, equals(data)); |
+ })); |
+ }); |
+ }); |
} |