mirror of
https://github.com/foss42/apidash.git
synced 2025-06-06 03:18:43 +08:00
Merge branch 'main' of https://github.com/foss42/apidash
This commit is contained in:
packages/apidash_core/lib
@ -4,8 +4,13 @@ enum HTTPVerb { get, head, post, put, patch, delete }
|
|||||||
|
|
||||||
enum FormDataType { text, file }
|
enum FormDataType { text, file }
|
||||||
|
|
||||||
const kSupportedUriSchemes = ["https", "http"];
|
enum SupportedUriSchemes { https, http }
|
||||||
|
|
||||||
|
final kSupportedUriSchemes =
|
||||||
|
SupportedUriSchemes.values.map((i) => i.name).toList();
|
||||||
const kDefaultUriScheme = "https";
|
const kDefaultUriScheme = "https";
|
||||||
|
final kLocalhostRegex = RegExp(r'^localhost(:\d+)?(/.*)?$');
|
||||||
|
|
||||||
const kMethodsWithBody = [
|
const kMethodsWithBody = [
|
||||||
HTTPVerb.post,
|
HTTPVerb.post,
|
||||||
HTTPVerb.put,
|
HTTPVerb.put,
|
||||||
|
@ -29,6 +29,10 @@ String stripUrlParams(String url) {
|
|||||||
if (url == null || url == "") {
|
if (url == null || url == "") {
|
||||||
return (null, "URL is missing!");
|
return (null, "URL is missing!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (kLocalhostRegex.hasMatch(url)) {
|
||||||
|
url = '${SupportedUriSchemes.http.name}://$url';
|
||||||
|
}
|
||||||
Uri? uri = Uri.tryParse(url);
|
Uri? uri = Uri.tryParse(url);
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
return (null, "Check URL (malformed)");
|
return (null, "Check URL (malformed)");
|
||||||
|
Reference in New Issue
Block a user