onRequest method
Called when the request is about to be sent.
Implementation
@override
void onRequest(options, handler) async {
OnRequestHandler? onRequestHandler = HttpService.to.onRequestHandler;
if (onRequestHandler != null) {
if (await onRequestHandler(options, handler)) {
return;
}
}
String? authorization = HttpService.to.authorization;
if (authorization.isNotEmptyOrNull) {
if (!options.headers.containsKey('Authorization')) {
options.headers.addAll({'Authorization': authorization});
}
}
handler.next(options);
}