From 33268278d0f88a4ff5f240b76a0794565c15ac4e Mon Sep 17 00:00:00 2001 From: orz12 Date: Mon, 2 Sep 2024 02:13:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20get=E4=B8=8D=E4=BD=BF=E7=94=A8options?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/http/init.dart | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/http/init.dart b/lib/http/init.dart index 18bccb65..50d7e650 100644 --- a/lib/http/init.dart +++ b/lib/http/init.dart @@ -28,7 +28,8 @@ class Request { late bool enableSystemProxy; late String systemProxyHost; late String systemProxyPort; - static final RegExp spmPrefixExp = RegExp(r''); + static final RegExp spmPrefixExp = + RegExp(r''); /// 设置cookie static setCookie() async { @@ -97,11 +98,10 @@ class Request { String spmPrefix = spmPrefixExp.firstMatch(html.data)!.group(1)!; Random rand = Random(); String rand_png_end = base64.encode( - List.generate(32, (_) => rand.nextInt(256)) + - List.filled(4, 0) + - [73, 69, 78, 68] + - List.generate(4, (_) => rand.nextInt(256)) - ); + List.generate(32, (_) => rand.nextInt(256)) + + List.filled(4, 0) + + [73, 69, 78, 68] + + List.generate(4, (_) => rand.nextInt(256))); String jsonData = json.encode({ '3064': 1, @@ -112,11 +112,9 @@ class Request { }, }); - await Request().post( - Api.activateBuvidApi, - data: {'payload': jsonData}, - options: Options(contentType: 'application/json') - ); + await Request().post(Api.activateBuvidApi, + data: {'payload': jsonData}, + options: Options(contentType: 'application/json')); } /* @@ -192,7 +190,7 @@ class Request { */ get(url, {data, options, cancelToken, extra}) async { Response response; - final Options options = Options(); + options ??= Options(); ResponseType resType = ResponseType.json; if (extra != null) { resType = extra!['resType'] ?? ResponseType.json;