mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
committed by
GitHub
parent
a46bde68f5
commit
c090cae1a1
@@ -164,10 +164,8 @@ class Request {
|
||||
: http11Adapter;
|
||||
|
||||
// 先于其他Interceptor
|
||||
if (GStorage.retryCount > 0) {
|
||||
dio.interceptors
|
||||
.add(RetryInterceptor(GStorage.retryCount, GStorage.retryDelay));
|
||||
}
|
||||
dio.interceptors
|
||||
.add(RetryInterceptor(GStorage.retryCount, GStorage.retryDelay));
|
||||
|
||||
// 日志拦截器 输出请求、响应内容
|
||||
if (BuildConfig.isDebug) {
|
||||
@@ -222,7 +220,7 @@ class Request {
|
||||
* post请求
|
||||
*/
|
||||
Future<Response> post(url,
|
||||
{data, queryParameters, options, cancelToken, isRedirect}) async {
|
||||
{data, queryParameters, options, cancelToken}) async {
|
||||
// debugPrint('post-data: $data');
|
||||
Response response;
|
||||
try {
|
||||
@@ -236,20 +234,6 @@ class Request {
|
||||
// debugPrint('post success: ${response.data}');
|
||||
return response;
|
||||
} on DioException catch (e) {
|
||||
if (isRedirect != true &&
|
||||
const [301, 302, 303, 307, 308].contains(e.response?.statusCode)) {
|
||||
String? redirectUrl = e.response?.headers['location']?.firstOrNull;
|
||||
if (redirectUrl != null) {
|
||||
return await post(
|
||||
redirectUrl,
|
||||
data: data,
|
||||
queryParameters: queryParameters,
|
||||
options: options,
|
||||
cancelToken: cancelToken,
|
||||
isRedirect: true,
|
||||
);
|
||||
}
|
||||
}
|
||||
AccountManager.toast(e);
|
||||
Response errResponse = Response(
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user