onRequest method
- RequestOptions options,
- RequestInterceptorHandler handler
override
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 DioException object with handler.reject
.
Implementation
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
super.onRequest(options, handler);
log('[ URL: ${options.baseUrl}${options.path} ]');
log('[ Headers: ${options.headers} ]');
log('[ Request: ${options.data} ]');
}