fix potential network issue

This commit is contained in:
2024-11-13 19:28:47 +08:00
parent 194abb82de
commit dd7154830b

View File

@@ -206,19 +206,22 @@ class AppDio with DioMixin {
: rhttp.ProxySettings.proxy(proxy!),
));
}
var res = super.request<T>(
path,
data: data,
queryParameters: queryParameters,
cancelToken: cancelToken,
options: options,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
if(_requests.containsKey(path)) {
_requests.remove(path);
try {
return super.request<T>(
path,
data: data,
queryParameters: queryParameters,
cancelToken: cancelToken,
options: options,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
finally {
if(_requests.containsKey(path)) {
_requests.remove(path);
}
}
return res;
}
}