Dart API Referencedart:ioHttpResponse

HttpResponse Interface

HTTP response to be send back to the client.

Methods

Code HttpConnectionInfo get connectionInfo() #

Get information about the client connection. Returns null if the socket isn't available.

HttpConnectionInfo get connectionInfo();

Code List<Cookie> get cookies() #

Cookies to set in the client (in the Set-Cookie header).

List<Cookie> get cookies();

Code DetachedSocket detachSocket() #

Detach the underlying socket from the HTTP server. When the socket is detached the HTTP server will no longer perform any operations on it.

This is normally used when a HTTP upgrade request is received and the communication should continue with a different protocol.

DetachedSocket detachSocket();

Code HttpHeaders get headers() #

Returns the response headers.

HttpHeaders get headers();

Code OutputStream get outputStream() #

Returns the output stream for the response. This is used to write the response data. When all response data has been written close the stream to indicate the end of the response.

When this is accessed for the first time the response header is send. Calling any methods that will change the header after having retrieved the output stream will throw an exception.

OutputStream get outputStream();

Fields

Code int contentLength #

Gets and sets the content length of the response. If the size of the response is not known in advance set the content length to -1 - which is also the default if not set.

int contentLength;

Code bool persistentConnection #

Gets and sets the persistent connection state. The initial value of this property is the persistent connection state from the request.

bool persistentConnection;

Code String reasonPhrase #

Gets and sets the reason phrase. If no reason phrase is explicitly set a default reason phrase is provided.

String reasonPhrase;

Code int statusCode #

Gets and sets the status code. Any integer value is accepted, but for the official HTTP status codes use the fields from HttpStatus.

int statusCode;