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