Response.badRequest constructor

Response.badRequest({
  1. Body? body,
  2. Headers? headers,
})

Constructs a 400 Bad Request response.

This indicates that the server has received a malformed request.

body is the response body. It may be a Body instance or null to indicate no body. Use Body.fromString, Body.fromBytes, or Body.fromDataStream to create the body with the appropriate content type and encoding.

headers must contain values that are either String or List<String>. An empty list will cause the header to be omitted.

Implementation

Response.badRequest({final Body? body, final Headers? headers})
  : this(
      400,
      headers: headers ?? Headers.empty(),
      body: body ?? Body.fromString('Bad Request'),
    );