send method

  1. @override
Future<StreamedResponse> send(
  1. BaseRequest request
)

Sends an HTTP request with authentication headers.

Adds the bearer token obtained from the AzureAuthAbstract to the "Authorization" header. Throws an exception if the access token is not available.

Implementation

@override
Future<StreamedResponse> send(BaseRequest request) async {
  var accessToken = await _authenticationProvider.getAccessToken();

  if (accessToken == null) {
    throw Exception('Access token is not available.');
  }

  request.headers['Authorization'] = 'Bearer $accessToken';

  return await _inner.send(request);
}