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