mirror of
https://github.com/foss42/apidash.git
synced 2025-12-03 11:27:50 +08:00
format
This commit is contained in:
@@ -2,9 +2,7 @@ import 'package:http_parser/http_parser.dart';
|
|||||||
import '../consts.dart';
|
import '../consts.dart';
|
||||||
import '../extensions/extensions.dart';
|
import '../extensions/extensions.dart';
|
||||||
|
|
||||||
ContentType? getContentTypeFromHeadersMap(
|
ContentType? getContentTypeFromHeadersMap(Map<String, String>? kvMap) {
|
||||||
Map<String, String>? kvMap,
|
|
||||||
) {
|
|
||||||
if (kvMap != null && kvMap.hasKeyContentType()) {
|
if (kvMap != null && kvMap.hasKeyContentType()) {
|
||||||
var val = getMediaTypeFromHeaders(kvMap);
|
var val = getMediaTypeFromHeaders(kvMap);
|
||||||
return getContentTypeFromMediaType(val);
|
return getContentTypeFromMediaType(val);
|
||||||
@@ -43,9 +41,7 @@ ContentType? getContentTypeFromMediaType(MediaType? mediaType) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentType? getContentTypeFromContentTypeStr(
|
ContentType? getContentTypeFromContentTypeStr(String? contentType) {
|
||||||
String? contentType,
|
|
||||||
) {
|
|
||||||
if (contentType != null) {
|
if (contentType != null) {
|
||||||
var val = getMediaTypeFromContentType(contentType);
|
var val = getMediaTypeFromContentType(contentType);
|
||||||
return getContentTypeFromMediaType(val);
|
return getContentTypeFromMediaType(val);
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import '../models/models.dart';
|
|||||||
|
|
||||||
String? getGraphQLBody(HttpRequestModel httpRequestModel) {
|
String? getGraphQLBody(HttpRequestModel httpRequestModel) {
|
||||||
if (httpRequestModel.hasQuery) {
|
if (httpRequestModel.hasQuery) {
|
||||||
return kJsonEncoder.convert({
|
return kJsonEncoder.convert({"query": httpRequestModel.query});
|
||||||
"query": httpRequestModel.query,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,12 @@ class RandomStringGenerator {
|
|||||||
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
|
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
|
||||||
static Random rnd = Random();
|
static Random rnd = Random();
|
||||||
|
|
||||||
static String getRandomString(int length) =>
|
static String getRandomString(int length) => String.fromCharCodes(
|
||||||
String.fromCharCodes(Iterable.generate(
|
Iterable.generate(
|
||||||
length, (_) => _chars.codeUnitAt(rnd.nextInt(_chars.length))));
|
length,
|
||||||
|
(_) => _chars.codeUnitAt(rnd.nextInt(_chars.length)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
static String getRandomStringLines(int lines, int length) {
|
static String getRandomStringLines(int lines, int length) {
|
||||||
List<String> result = [];
|
List<String> result = [];
|
||||||
|
|||||||
@@ -23,8 +23,10 @@ String stripUrlParams(String url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
(Uri?, String?) getValidRequestUri(
|
(Uri?, String?) getValidRequestUri(
|
||||||
String? url, List<NameValueModel>? requestParams,
|
String? url,
|
||||||
{SupportedUriSchemes defaultUriScheme = kDefaultUriScheme}) {
|
List<NameValueModel>? requestParams, {
|
||||||
|
SupportedUriSchemes defaultUriScheme = kDefaultUriScheme,
|
||||||
|
}) {
|
||||||
url = url?.trim();
|
url = url?.trim();
|
||||||
if (url == null || url == "") {
|
if (url == null || url == "") {
|
||||||
return (null, "URL is missing!");
|
return (null, "URL is missing!");
|
||||||
|
|||||||
Reference in New Issue
Block a user