Index: utils/pub/oauth2.dart |
diff --git a/utils/pub/oauth2.dart b/utils/pub/oauth2.dart |
index 49de1c0bcf673debc769ca7a8e144176c20b4238..4960dced1c5b89fedd11fee6457c3a951070e7c5 100644 |
--- a/utils/pub/oauth2.dart |
+++ b/utils/pub/oauth2.dart |
@@ -157,9 +157,13 @@ Future<Client> _authorize() { |
if (queryString == null) queryString = ''; |
response.statusCode = 302; |
response.headers.set('location', 'http://pub.dartlang.org/authorized'); |
- response.outputStream.close(); |
+ return Futures.wait([ |
+ closeHttpResponse(request, response), |
+ grant.handleAuthorizationResponse(queryToMap(queryString)) |
+ ]); |
+ }).transform((results) { |
server.close(); |
- return grant.handleAuthorizationResponse(queryToMap(queryString)); |
+ return results[1]; |
}), completer); |
}); |
server.listen('127.0.0.1', 0); |