beforeRequest method
Runs immediately before the request is sent. Default forwards unchanged.
Typical uses: ensure valid access token, attach headers, refresh and retry
by calling handler.resolve with a cloned request after refresh.
Implementation
@override
Future<void> beforeRequest(
RequestOptions options,
RequestInterceptorHandler handler,
) async {
if (onBeforeRequest != null) {
await onBeforeRequest!(options, handler);
} else {
handler.next(options);
}
}