From 451c679d60b6ae42c48fa91dfa8420ac96fdd638 Mon Sep 17 00:00:00 2001 From: Nate Bosch Date: Tue, 8 Dec 2020 16:11:52 -0800 Subject: [PATCH] Pass a Uri to package:http APIs Prepare for https://github.com/dart-lang/http/issues/375 --- lib/src/command/lish.dart | 3 ++- lib/src/command/login.dart | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/src/command/lish.dart b/lib/src/command/lish.dart index ab7cd6c0d..abc0c65e1 100644 --- a/lib/src/command/lish.dart +++ b/lib/src/command/lish.dart @@ -96,7 +96,8 @@ class LishCommand extends PubCommand { 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 5af099a95..4dcf52e9e 100644 --- a/lib/src/command/login.dart +++ b/lib/src/command/login.dart @@ -40,8 +40,8 @@ class LoginCommand extends PubCommand { 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;