mirror of
https://github.com/foss42/apidash.git
synced 2025-05-31 06:08:09 +08:00
feat(uriScheme): Added the support for uriScheme without prefix http/https
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import 'package:collection/collection.dart' show mergeMaps;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import '../consts.dart';
|
||||
import '../models/name_value_model.dart';
|
||||
import 'http_request_utils.dart';
|
||||
@ -29,6 +30,10 @@ String stripUrlParams(String url) {
|
||||
if (url == null || url == "") {
|
||||
return (null, "URL is missing!");
|
||||
}
|
||||
final localhostRegex = RegExp(r'^localhost(:\d+)?(/.*)?$');
|
||||
if (localhostRegex.hasMatch(url)) {
|
||||
url = 'http://$url';
|
||||
}
|
||||
Uri? uri = Uri.tryParse(url);
|
||||
if (uri == null) {
|
||||
return (null, "Check URL (malformed)");
|
||||
|
Reference in New Issue
Block a user