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

Unified Diff: utils/pub/http.dart

Issue 11830017: Fix ALL the pub tests. (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: utils/pub/http.dart
diff --git a/utils/pub/http.dart b/utils/pub/http.dart
index 1c349786a1ced8b7f98f52838cdb8452ed3675cc..d02c0ab38dfee3f15fb5367bcbcf70f62f31dc6b 100644
--- a/utils/pub/http.dart
+++ b/utils/pub/http.dart
@@ -7,7 +7,7 @@ library pub.http;
import 'dart:async';
import 'dart:io';
-import 'dart:json';
+import 'dart:json' as json;
// TODO(nweiz): Make this import better.
import '../../pkg/http/lib/http.dart' as http;
@@ -57,8 +57,8 @@ class PubHttpClient extends http.BaseClient {
return http.Response.fromStream(streamedResponse).then((response) {
throw new PubHttpException(response);
});
- }).catchError((e) {
- e = getRealError(e);
+ }).catchError((asyncError) {
+ var e = getRealError(asyncError);
if (e is SocketIOException &&
e.osError != null &&
(e.osError.errorCode == 8 ||
@@ -67,7 +67,7 @@ class PubHttpClient extends http.BaseClient {
e.osError.errorCode == 11004)) {
throw 'Could not resolve URL "${request.url.origin}".';
}
- throw e;
+ throw asyncError;
}), HTTP_TIMEOUT, 'fetching URL "${request.url}"');
}
}
@@ -112,7 +112,7 @@ void handleJsonError(http.Response response) {
Map parseJsonResponse(http.Response response) {
var value;
try {
- value = JSON.parse(response.body);
+ value = json.parse(response.body);
} catch (e) {
// TODO(nweiz): narrow this catch clause once issue 6775 is fixed.
invalidServerResponse(response);

Powered by Google App Engine
This is Rietveld 408576698