Index: dart/pkg/http_base/test/http_base_html_test.dart |
diff --git a/dart/pkg/http_base/test/http_base_html_test.dart b/dart/pkg/http_base/test/http_base_html_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a1efb7d584d08f68782c80aa2493d1dd517525e9 |
--- /dev/null |
+++ b/dart/pkg/http_base/test/http_base_html_test.dart |
@@ -0,0 +1,27 @@ |
+library http_base.http_base_html_test; |
+ |
+import 'dart:html'; |
+import 'dart:async'; |
+import 'dart:convert'; |
+ |
+import 'package:http_base/http_base_html.dart'; |
+import 'package:unittest/unittest.dart'; |
+ |
+main() { |
+ test('http-client', () { |
+ var uri = Uri.parse(window.location.href).resolve('/echo'); |
+ |
+ var client = new Client(); |
+ var body = (new StreamController() |
+ ..add(UTF8.encode('my-data')) |
+ ..close()).stream; |
+ var request = new RequestImpl('POST', uri, body: body); |
+ client(request).then(expectAsync((response) { |
+ expect(response.statusCode, equals(200)); |
+ response.read() |
+ .transform(UTF8.decoder).join('').then(expectAsync((data) { |
+ expect(data, equals('my-data')); |
+ })); |
+ })); |
+ }); |
+} |