We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flutter version: 3.10.4 dio version : 5.4.0
When I call handler.reject(DioException(requestOptions: options)) in onError, The caller displays the following error:
Exception has occurred. DioException (DioException [unknown]: null)
I don't understand now why the caller reports an error after rejecting. How should I use reject? Please help. Thank you. my code like this:
Response res = await RestApi.post( path: "/test/test", data: {"mobile": "1000000000"}); if (res == null) { print("请求失败"); }
interceptor code like this:
_dio.interceptors.add(QueuedInterceptorsWrapper( onRequest: (options, handler) async { options.headers["access"] = _token; return handler.next(options); //continue }, onResponse: (response, handler) { String path = response.requestOptions.path; if (path.contains("login")) { _token = response.data["accessToken"]; _token2 = response.data["refreshToken"]; } debugPrint(path); return handler.next(response); // continue }, onError: (error, handler) async { if (error.response?.statusCode == 401) { final options = error.response!.requestOptions; bool bSucc = await refreshToken(); if (bSucc) { var res = await _dio.fetch(error.response!.requestOptions); handler.resolve(res); //continue } else { handler.reject(DioException(requestOptions: options)); } } else { handler.next(error); } }, ));
No response
The text was updated successfully, but these errors were encountered:
Please use discussions for general issues.
Sorry, something went wrong.
No branches or pull requests
Request Statement
flutter version: 3.10.4
dio version : 5.4.0
When I call handler.reject(DioException(requestOptions: options)) in onError, The caller displays the following error:
I don't understand now why the caller reports an error after rejecting. How should I use reject? Please help. Thank you.
my code like this:
interceptor code like this:
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: