Pass a Uri to package:http APIs (#2794)
Prepare for https://github.com/dart-lang/http/issues/375
diff --git a/lib/src/command/lish.dart b/lib/src/command/lish.dart
index ab7cd6c..abc0c65 100644
--- a/lib/src/command/lish.dart
+++ b/lib/src/command/lish.dart
@@ -96,7 +96,8 @@
var location = postResponse.headers['location'];
if (location == null) throw PubHttpException(postResponse);
- handleJsonSuccess(await client.get(location, headers: pubApiHeaders));
+ handleJsonSuccess(
+ await client.get(Uri.parse(location), headers: pubApiHeaders));
});
});
} on PubHttpException catch (error) {
diff --git a/lib/src/command/login.dart b/lib/src/command/login.dart
index 5af099a..4dcf52e 100644
--- a/lib/src/command/login.dart
+++ b/lib/src/command/login.dart
@@ -40,8 +40,8 @@
Future<_UserInfo> retrieveUserInfo() async {
return await oauth2.withClient(cache, (client) async {
- final discovery = await httpClient
- .get('https://accounts.google.com/.well-known/openid-configuration');
+ final discovery = await httpClient.get(Uri.https(
+ 'accounts.google.com', '/.well-known/openid-configuration'));
final userInfoEndpoint = json.decode(discovery.body)['userinfo_endpoint'];
final userInfoRequest = await client.get(userInfoEndpoint);
if (userInfoRequest.statusCode != 200) return null;