send method

Do not override this method on AWSBaseHttpClient.

To modify the underlying send, override baseClient instead.

Implementation

@override
@nonVirtual
AWSHttpOperation send(
  AWSBaseHttpRequest request, {
  FutureOr<void> Function()? onCancel,
}) {
  final requestProgressController =
      StreamController<int>.broadcast(sync: true);
  final responseProgressController =
      StreamController<int>.broadcast(sync: true);

  final completer = CancelableCompleter<AWSBaseHttpResponse>(
    onCancel: () {
      requestProgressController.close();
      responseProgressController.close();
      return onCancel?.call();
    },
  );
  _send(
    request,
    completer,
    requestProgressController: requestProgressController,
    responseProgressController: responseProgressController,
  );
  return AWSHttpOperation(
    completer.operation,
    requestProgress: requestProgressController.stream,
    responseProgress: responseProgressController.stream,
    onCancel: onCancel,
  );
}