mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 09:04:45 +08:00
feat: rust/rsHttp Option with_custom_dns
This commit is contained in:
@ -14,49 +14,73 @@ class RSHttp {
|
||||
});
|
||||
}
|
||||
|
||||
static Future<RustHttpResponse> get(String url,
|
||||
{Map<String, String>? headers, String? withIpAddress}) async {
|
||||
static Future<RustHttpResponse> get(
|
||||
String url, {
|
||||
Map<String, String>? headers,
|
||||
String? withIpAddress,
|
||||
bool? withCustomDns,
|
||||
}) async {
|
||||
final r = await rust_http.fetch(
|
||||
method: MyMethod.gets,
|
||||
url: url,
|
||||
headers: headers,
|
||||
withIpAddress: withIpAddress);
|
||||
method: MyMethod.gets,
|
||||
url: url,
|
||||
headers: headers,
|
||||
withIpAddress: withIpAddress,
|
||||
withCustomDns: withCustomDns,
|
||||
);
|
||||
return r;
|
||||
}
|
||||
|
||||
static Future<String> getText(String url,
|
||||
{Map<String, String>? headers, String? withIpAddress}) async {
|
||||
final r = await get(url, headers: headers, withIpAddress: withIpAddress);
|
||||
static Future<String> getText(
|
||||
String url, {
|
||||
Map<String, String>? headers,
|
||||
String? withIpAddress,
|
||||
bool? withCustomDns,
|
||||
}) async {
|
||||
final r = await get(url,
|
||||
headers: headers,
|
||||
withIpAddress: withIpAddress,
|
||||
withCustomDns: withCustomDns);
|
||||
if (r.data == null) return "";
|
||||
final str = utf8.decode(r.data!);
|
||||
return str;
|
||||
}
|
||||
|
||||
static Future<RustHttpResponse> postData(String url,
|
||||
{Map<String, String>? headers,
|
||||
String? contentType,
|
||||
Uint8List? data,
|
||||
String? withIpAddress}) async {
|
||||
static Future<RustHttpResponse> postData(
|
||||
String url, {
|
||||
Map<String, String>? headers,
|
||||
String? contentType,
|
||||
Uint8List? data,
|
||||
String? withIpAddress,
|
||||
bool? withCustomDns,
|
||||
}) async {
|
||||
if (contentType != null) {
|
||||
headers ??= {};
|
||||
headers["Content-Type"] = contentType;
|
||||
}
|
||||
final r = await rust_http.fetch(
|
||||
method: MyMethod.post,
|
||||
url: url,
|
||||
headers: headers,
|
||||
inputData: data,
|
||||
withIpAddress: withIpAddress);
|
||||
method: MyMethod.post,
|
||||
url: url,
|
||||
headers: headers,
|
||||
inputData: data,
|
||||
withIpAddress: withIpAddress,
|
||||
withCustomDns: withCustomDns,
|
||||
);
|
||||
return r;
|
||||
}
|
||||
|
||||
static Future<RustHttpResponse> head(String url,
|
||||
{Map<String, String>? headers, String? withIpAddress}) async {
|
||||
static Future<RustHttpResponse> head(
|
||||
String url, {
|
||||
Map<String, String>? headers,
|
||||
String? withIpAddress,
|
||||
bool? withCustomDns,
|
||||
}) async {
|
||||
final r = await rust_http.fetch(
|
||||
method: MyMethod.head,
|
||||
url: url,
|
||||
headers: headers,
|
||||
withIpAddress: withIpAddress);
|
||||
method: MyMethod.head,
|
||||
url: url,
|
||||
headers: headers,
|
||||
withIpAddress: withIpAddress,
|
||||
withCustomDns: withCustomDns,
|
||||
);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user