onRequest method
Handles HTTP requests before they are sent.
Logs request details including method, path, headers, and data.
Implementation
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
final requestPath = '${options.baseUrl}${options.path}';
logDebug('\n');
logDebug(_lineChar);
logDebug('onRequest: ${options.method} request => $requestPath',
level: LogLevel.info);
logDebug('onRequest: Request Headers => ${options.headers}',
level: LogLevel.info);
logDebug('onRequest: Request Data => ${_prettyJsonEncode(options.data)}',
level: LogLevel.info); // Log formatted request data
logDebug('\n');
// Call the super class to continue handling the request
return super.onRequest(options, handler);
}