cloneWith method

Future<Response> cloneWith({
  1. Map<String, String>? headers,
})

Creates a new Response instance with the same content and headers, appending the specified values from headers Map.

Implementation

Future<Response> cloneWith({Map<String, String>? headers}) async {
  ByteBuffer buffer = await clone().arrayBuffer();
  return Response._(facade.Response(
    buffer,
    facade.ResponseInit(
        status: status,
        statusText: statusText,
        headers: this.headers.clone(headers: headers)._delegate),
  ));
}