BaseResponse abstract class
The base class for HTTP responses.
Subclasses of BaseResponse are usually not constructed manually; instead,
they're returned by BaseClient.send or other HTTP client methods.
abstract class BaseResponse {
/// The (frozen) request that triggered this response.
final BaseRequest request;
/// The status code of the response.
final int statusCode;
/// The reason phrase associated with the status code.
final String reasonPhrase;
/// The size of the response body, in bytes. If the size of the request is not
/// known in advance, this is -1.
final int contentLength;
// TODO(nweiz): automatically parse cookies from headers
// TODO(nweiz): make this a HttpHeaders object.
/// The headers for this response.
final Map<String, String> headers;
/// Whether this response is a redirect.
final bool isRedirect;
/// Whether the server requested that a persistent connection be maintained.
final bool persistentConnection;
/// Creates a new HTTP response.
BaseResponse(
this.statusCode,
this.contentLength,
{this.request,
this.headers: const {},
this.isRedirect: false,
this.persistentConnection: true,
this.reasonPhrase});
}
Subclasses
Constructors
new BaseResponse(int statusCode, int contentLength, {BaseRequest request, Map<String, String> headers: const{}, bool isRedirect: false, bool persistentConnection: true, String reasonPhrase}) #
Creates a new HTTP response.
BaseResponse(
this.statusCode,
this.contentLength,
{this.request,
this.headers: const {},
this.isRedirect: false,
this.persistentConnection: true,
this.reasonPhrase});
Properties
final int contentLength #
The size of the response body, in bytes. If the size of the request is not known in advance, this is -1.
final int contentLength
final Map<String, String> headers #
The headers for this response.
final Map<String, String> headers
final bool persistentConnection #
Whether the server requested that a persistent connection be maintained.
final bool persistentConnection
final String reasonPhrase #
The reason phrase associated with the status code.
final String reasonPhrase
final BaseRequest request #
The (frozen) request that triggered this response.
final BaseRequest request