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

Unified Diff: utils/pub/io.dart

Issue 11416352: Handle OAuth2 AuthorizationExceptions in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index e070aeeb0c0d3530721c8965c8f09e8e4ee46117..5f5f70ce4046f7ae14bd554e26743e8359378fe9 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -517,7 +517,10 @@ class PubHttpClient extends http.BaseClient {
// TODO(nweiz): Ideally the timeout would extend to reading from the
// response input stream, but until issue 3657 is fixed that's not feasible.
return timeout(_inner.send(request).chain((streamedResponse) {
- if (streamedResponse.statusCode < 400) {
+ var status = streamedResponse.statusCode;
+ // 401 responses should be handled by the OAuth2 client. It's very
+ // unlikely that they'll be returned by non-OAuth2 requests.
+ if (status < 400 || status == 401) {
return new Future.immediate(streamedResponse);
}
@@ -951,7 +954,8 @@ class PubHttpException implements Exception {
const PubHttpException(this.response);
- String toString() => 'HTTP error ${response.statusCode}: ${response.reason}';
+ String toString() => 'HTTP error ${response.statusCode}: '
+ '${response.reasonPhrase}';
}
/**

Powered by Google App Engine
This is Rietveld 408576698