Creates a new Response by copying existing values and applying specified changes.
New key-value pairs in context
and headers
will be added to the copied
Response.
If context
or headers
includes a key that already exists, the
key-value pair will replace the corresponding entry in the copied
Response.
All other context and header values from the Response will be included in the copied Response unchanged.
body
is the request body. It may be either a String
or a
Stream
.>
Source
Response change(
{Map<String, String> headers, Map<String, Object> context, body}) {
headers = updateMap(this.headers, headers);
context = updateMap(this.context, context);
if (body == null) body = getBody(this);
return new Response(this.statusCode, body: body, headers: headers,
context: context);
}