Response class

Represents the information in an HTTP response.

This object can be used to write an HTTP response and contains conveniences for creating these objects.

Implements

Constructors

Response(int statusCode, Map<String, dynamic> headers, dynamic body)
The default constructor. [...]
Response.accepted({Map<String, dynamic> headers })
Represents a 202 response.
Response.badRequest({Map<String, dynamic> headers, dynamic body })
Represents a 400 response.
Response.conflict({Map<String, dynamic> headers, dynamic body })
Represents a 409 response.
Response.created(String location, { dynamic body, Map<String, dynamic> headers })
Represents a 201 response. [...]
Response.forbidden({Map<String, dynamic> headers, dynamic body })
Represents a 403 response.
Response.gone({Map<String, dynamic> headers, dynamic body })
Represents a 410 response.
Response.notFound({Map<String, dynamic> headers, dynamic body })
Represents a 404 response.
Response.notModified(DateTime lastModified, CachePolicy cachePolicy)
Represents a 304 response. [...]
Response.ok(dynamic body, { Map<String, dynamic> headers })
Represents a 200 response.
Response.serverError({Map<String, dynamic> headers, dynamic body })
Represents a 500 response.
Response.unauthorized({Map<String, dynamic> headers, dynamic body })
Represents a 401 response.

Properties

body ↔ dynamic
An object representing the body of the Response, which will be encoded when used to Request.respond. [...]
read / write
bufferOutput bool
Whether or not this instance should buffer its output or send it right away. [...]
read / write
cachePolicy CachePolicy
Cache policy that sets 'Cache-Control' headers for this instance. [...]
read / write
contentType ContentType
The content type of the body of this response. [...]
read / write
encodeBody bool
Whether or not the body object of this instance should be encoded. [...]
read / write
hasExplicitlySetContentType bool
Whether or nor this instance has explicitly has its contentType property. [...]
read-only
headers Map<String, dynamic>
Map of headers to send in this response. [...]
read / write
statusCode int
The HTTP status code of this response.
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
inherited

Static Properties

defaultContentType ContentType
The default value of a contentType. [...]
read / write