This commit is contained in:
Ankit Mahato
2025-06-29 06:16:45 +05:30
parent 028d8c9ce6
commit 9edd43b298
4 changed files with 13 additions and 14 deletions

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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 = [];

View File

@@ -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!");