copyWith method

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

Creates a copy of this request with the specified fields replaced.

Useful in middleware pipelines for mutating request context, headers, or parameters.

Implementation

BloomRequest copyWith({
  String? method,
  Uri? uri,
  Map<String, String>? headers,
  Map<String, String>? params,
  Uint8List? rawBody,
  Stream<List<int>>? streamBody,
  int? maxRequestBodyBytes,
  bool? isSecure,
}) {
  return BloomRequest(
    method: method ?? this.method,
    uri: uri ?? this.uri,
    headers: headers ?? this.headers,
    params: params ?? this.params,
    rawBody: rawBody ?? _rawBody,
    streamBody: streamBody ?? _streamBody,
    maxRequestBodyBytes: maxRequestBodyBytes ?? _maxRequestBodyBytes,
    isSecure: isSecure ?? this.isSecure,
  );
}