Pass only Uri to package:http APIs (#74285)
This commit is contained in:
parent
5318782ac8
commit
dcc4fdd558
@ -68,9 +68,8 @@ class StockData extends ChangeNotifier {
|
||||
static const int _chunkCount = 30;
|
||||
int _nextChunk = 0;
|
||||
|
||||
String _urlToFetch(int chunk) {
|
||||
return 'https://domokit.github.io/examples/stocks/data/stock_data_$chunk.json';
|
||||
}
|
||||
Uri _urlToFetch(int chunk) => Uri.https(
|
||||
'domokit.github.io', 'examples/stocks/data/stock_data_$chunk.json');
|
||||
|
||||
http.Client _httpClient;
|
||||
|
||||
|
@ -170,7 +170,7 @@ class Cocoon {
|
||||
|
||||
/// Make an API request to Cocoon.
|
||||
Future<Map<String, dynamic>> _sendCocoonRequest(String apiPath, [dynamic jsonData]) async {
|
||||
final String url = '$baseCocoonApiUrl/$apiPath';
|
||||
final Uri url = Uri.parse('$baseCocoonApiUrl/$apiPath');
|
||||
|
||||
/// Retry requests to Cocoon as sometimes there are issues with the servers, such
|
||||
/// as version changes to the backend, datastore issues, or latency issues.
|
||||
|
@ -28,7 +28,7 @@ Future<void> main(List<String> args) async {
|
||||
Future<Archive> fetchArchive(String url, int maxTries) async {
|
||||
List<int> responseBytes;
|
||||
for (int i = 0; i < maxTries; i++) {
|
||||
final http.Response response = await http.get(url);
|
||||
final http.Response response = await http.get(Uri.parse(url));
|
||||
if (response.statusCode == 200) {
|
||||
responseBytes = response.bodyBytes;
|
||||
break;
|
||||
|
@ -53,9 +53,9 @@ class DevtoolsServerLauncher extends DevtoolsLauncher {
|
||||
try {
|
||||
const String pubHostedUrlKey = 'PUB_HOSTED_URL';
|
||||
if (_platform.environment.containsKey(pubHostedUrlKey)) {
|
||||
await http.head(_platform.environment[pubHostedUrlKey]);
|
||||
await http.head(Uri.parse(_platform.environment[pubHostedUrlKey]));
|
||||
} else {
|
||||
await http.head('https://pub.dev');
|
||||
await http.head(Uri.https('pub.dev', ''));
|
||||
}
|
||||
} on Exception {
|
||||
offline = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user