Response(int statusCode, {body, Map<String, String> headers, Encoding encoding, Map<String, Object> context})

Constructs an HTTP response with the given statusCode.

statusCode must be greater than or equal to 100.

body is the response body. It may be either a String, a Stream>, or null to indicate no body. If it's a String, encoding is used to encode it to a Stream>. The default encoding is UTF-8.

If encoding is passed, the "encoding" field of the Content-Type header in headers will be set appropriately. If there is no existing Content-Type header, it will be set to "application/octet-stream".

Source

Response(this.statusCode, {body, Map<String, String> headers,
    Encoding encoding, Map<String, Object> context})
    : super(body, encoding: encoding, headers: headers, context: context) {
  if (statusCode < 100) {
    throw new ArgumentError("Invalid status code: $statusCode.");
  }
}