mirror of
https://github.com/foss42/apidash.git
synced 2025-12-02 18:57:05 +08:00
Merge branch 'main' into add-request-cancellation
This commit is contained in:
@@ -13,7 +13,7 @@ enum SupportedUriSchemes { https, http }
|
||||
|
||||
final kSupportedUriSchemes =
|
||||
SupportedUriSchemes.values.map((i) => i.name).toList();
|
||||
const kDefaultUriScheme = "https";
|
||||
const kDefaultUriScheme = SupportedUriSchemes.https;
|
||||
final kLocalhostRegex = RegExp(r'^localhost(:\d+)?(/.*)?$');
|
||||
|
||||
const kMethodsWithBody = [
|
||||
|
||||
@@ -12,7 +12,7 @@ typedef HttpResponse = http.Response;
|
||||
|
||||
Future<(HttpResponse?, Duration?, String?)> request(
|
||||
HttpRequestModel requestModel, {
|
||||
String defaultUriScheme = kDefaultUriScheme,
|
||||
SupportedUriSchemes defaultUriScheme = kDefaultUriScheme,
|
||||
String? requestId,
|
||||
}) async {
|
||||
final clientManager = HttpClientManager();
|
||||
|
||||
@@ -5,7 +5,7 @@ import 'http_request_utils.dart';
|
||||
|
||||
(String?, bool) getUriScheme(Uri uri) {
|
||||
if (uri.hasScheme) {
|
||||
if (kSupportedUriSchemes.contains(uri.scheme)) {
|
||||
if (kSupportedUriSchemes.contains(uri.scheme.toLowerCase())) {
|
||||
return (uri.scheme, true);
|
||||
}
|
||||
return (uri.scheme, false);
|
||||
@@ -24,7 +24,7 @@ String stripUrlParams(String url) {
|
||||
|
||||
(Uri?, String?) getValidRequestUri(
|
||||
String? url, List<NameValueModel>? requestParams,
|
||||
{String defaultUriScheme = kDefaultUriScheme}) {
|
||||
{SupportedUriSchemes defaultUriScheme = kDefaultUriScheme}) {
|
||||
url = url?.trim();
|
||||
if (url == null || url == "") {
|
||||
return (null, "URL is missing!");
|
||||
@@ -44,7 +44,7 @@ String stripUrlParams(String url) {
|
||||
return (null, "Unsupported URL Scheme (${urlScheme.$1})");
|
||||
}
|
||||
} else {
|
||||
url = "$defaultUriScheme://$url";
|
||||
url = "${defaultUriScheme.name}://$url";
|
||||
}
|
||||
|
||||
uri = Uri.parse(url);
|
||||
|
||||
Reference in New Issue
Block a user