onRequest method
The callback will be executed before the request is initiated.
If you want to continue the request, call handler.next
.
If you want to complete the request with some custom data,
you can resolve a Response object with handler.resolve
.
If you want to complete the request with an error message,
you can reject a DioError object with handler.reject
.
Implementation
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
path = options.path;
if (map != null && map!.isNotEmpty) {
//没有param的时候是一个空的对象
map = options.queryParameters;
} else {
map = null;
}
return handler.next(options);
}