fix: 第三方登录重定向、有效状态码整理

This commit is contained in:
guozhigq
2023-09-14 23:35:08 +08:00
parent 6d2e0f2049
commit 33413cdb51
6 changed files with 55 additions and 8 deletions

View File

@ -1,8 +1,6 @@
PODS:
- appscheme (1.0.4):
- Flutter
- auto_orientation (0.0.1):
- Flutter
- connectivity_plus (0.0.1):
- Flutter
- ReachabilitySwift
@ -54,7 +52,6 @@ PODS:
DEPENDENCIES:
- appscheme (from `.symlinks/plugins/appscheme/ios`)
- auto_orientation (from `.symlinks/plugins/auto_orientation/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`)
@ -85,8 +82,6 @@ SPEC REPOS:
EXTERNAL SOURCES:
appscheme:
:path: ".symlinks/plugins/appscheme/ios"
auto_orientation:
:path: ".symlinks/plugins/auto_orientation/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
device_info_plus:
@ -132,7 +127,6 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
appscheme: b1c3f8862331cb20430cf9e0e4af85dbc1572ad8
auto_orientation: 102ed811a5938d52c86520ddd7ecd3a126b5d39d
connectivity_plus: 07c49e96d7fc92bc9920617b83238c4d178b446a
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854

View File

@ -2,4 +2,37 @@ class HttpString {
static const String baseUrl = 'https://www.bilibili.com';
static const String baseApiUrl = 'https://api.bilibili.com';
static const String tUrl = 'https://api.vc.bilibili.com';
static const List<int> validateStatusCodes = [
302,
304,
307,
400,
401,
403,
404,
405,
409,
412,
500,
503,
504,
509,
616,
617,
625,
626,
628,
629,
632,
643,
650,
652,
658,
662,
688,
689,
701,
799,
8888
];
}

View File

@ -118,7 +118,8 @@ class Request {
dio.transformer = BackgroundTransformer();
dio.options.validateStatus = (status) {
return status! >= 200 && status < 300 || status == 304 || status == 302;
return status! >= 200 && status < 300 ||
HttpString.validateStatusCodes.contains(status);
};
}

View File

@ -83,7 +83,9 @@ class SearchHttp {
return {
'status': false,
'data': [],
'msg': res.data['data']['numPages'] == 0 ? '没有相关数据' : '请求错误 🙅',
'msg': res.data['data'] != null && res.data['data']['numPages'] == 0
? '没有相关数据'
: res.data['message'],
};
}
}

View File

@ -337,6 +337,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.0"
dio_http2_adapter:
dependency: "direct main"
description:
name: dio_http2_adapter
sha256: "3d81128cf389649ae6ac5cce23bcf5f9b254882b7f27185ca3b0d443ee9b825c"
url: "https://pub.dev"
source: hosted
version: "2.3.1+1"
dismissible_page:
dependency: "direct main"
description:
@ -621,6 +629,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
http2:
dependency: transitive
description:
name: http2
sha256: "38db0c4aa9f1cd238a5d2e86aa0cc7cc91c77e0c6c94ba64bbe85e4ff732a952"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
http_client_helper:
dependency: transitive
description:

View File

@ -45,6 +45,7 @@ dependencies:
cookie_jar: ^4.0.8
dio_cookie_manager: ^3.1.0
connectivity_plus: ^4.0.1
dio_http2_adapter: ^2.3.1+1
# 图片
cached_network_image: ^3.2.3