BloomRequest constructor

BloomRequest({
  1. required String method,
  2. required Uri uri,
  3. Map<String, String> headers = const {},
  4. Map<String, String>? params,
  5. dynamic body,
  6. Uint8List? rawBody,
  7. Stream<List<int>>? streamBody,
  8. int? maxRequestBodyBytes,
  9. bool? isSecure,
})

Creates a BloomRequest instance.

body can be a Uint8List, List<int>, String, or a JSON-encodable Map/List. If rawBody is not provided directly and streamBody is null, it is automatically converted from body. If streamBody is provided, the request body is treated as a stream and not pre-buffered. If isSecure is omitted, it is inferred from uri.scheme.

Implementation

BloomRequest({
  required this.method,
  required this.uri,
  this.headers = const {},
  Map<String, String>? params,
  dynamic body,
  Uint8List? rawBody,
  Stream<List<int>>? streamBody,
  int? maxRequestBodyBytes,
  bool? isSecure,
})  : params = params ?? <String, String>{},
      _streamBody = streamBody,
      _maxRequestBodyBytes = maxRequestBodyBytes,
      _rawBody = streamBody != null ? null : (rawBody ?? _convertBody(body)),
      isSecure = isSecure ?? (uri.scheme.toLowerCase() == 'https');