AWSStreamedHttpRequest constructor

AWSStreamedHttpRequest({
  1. required AWSHttpMethod method,
  2. required Uri uri,
  3. Map<String, String>? headers,
  4. Stream<List<int>>? body,
  5. int? contentLength,
  6. bool? followRedirects,
  7. int? maxRedirects,
})

@{macro aws_common.aws_http_streamed_request}

For signed requests, body is read once, in chunks, as it is sent to AWS. It is recommended that contentLength be provided so that body does not have to be read twice, since the content length must be known when calculating the signature.

Implementation

AWSStreamedHttpRequest({
  required super.method,
  required Uri uri,
  super.headers,
  Stream<List<int>>? body,
  int? contentLength,
  super.followRedirects,
  super.maxRedirects,
})  : _body = body ?? const Stream.empty(),
      _contentLength = contentLength,
      super._(
        scheme: uri.scheme,
        host: uri.host,
        port: uri.hasPort ? uri.port : null,
        path: uri.path,
        queryParameters: uri.hasQuery ? uri.queryParametersAll : null,
      ) {
  _setContentTypeIfProvided(body);
}