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

Unified Diff: pkg/http/test/client_test.dart

Issue 11821018: Fix a bug in pkg/http where exceptions were getting top-leveled. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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: pkg/http/test/client_test.dart
diff --git a/pkg/http/test/client_test.dart b/pkg/http/test/client_test.dart
index d2f149c6344c8c72e3491f51e5860bf61f495b5a..97eacda4d23dff26a182a8fcc43eaa0965e86f62 100644
--- a/pkg/http/test/client_test.dart
+++ b/pkg/http/test/client_test.dart
@@ -5,6 +5,7 @@
library client_test;
import 'dart:io';
+import 'dart:uri';
import 'package:unittest/unittest.dart';
import 'package:http/http.dart' as http;
@@ -38,4 +39,17 @@ void main() {
request.sink.add('{"hello": "world"}'.charCodes);
request.sink.close();
});
+
+ test('#send with an invalid URL', () {
+ var client = new http.Client();
+ var url = new Uri.fromString('http://http.invalid');
+ var request = new http.StreamedRequest("POST", url);
+ request.headers[HttpHeaders.CONTENT_TYPE] =
+ 'application/json; charset=utf-8';
Bob Nystrom 2013/01/09 16:09:21 Nit: indent +2 more.
nweiz 2013/01/09 21:03:40 Done.
+
+ expect(client.send(request), throwsSocketIOException);
+
+ request.sink.add('{"hello": "world"}'.charCodes);
+ request.sink.close();
+ });
}

Powered by Google App Engine
This is Rietveld 408576698