| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library base_response; |
| 6 |
| 7 import 'dart:io'; |
| 8 |
| 9 /// The base class for HTTP responses. |
| 10 /// |
| 11 /// Subclasses of [BaseResponse] are usually not constructed manually; instead, |
| 12 /// they're returned by [BaseClient.send] or other HTTP client methods. |
| 13 abstract class BaseResponse { |
| 14 /// The status code of the response. |
| 15 final int statusCode; |
| 16 |
| 17 /// The reason phrase associated with the status code. |
| 18 final String reasonPhrase; |
| 19 |
| 20 /// The size of the response body, in bytes. If the size of the request is not |
| 21 /// known in advance, this is -1. |
| 22 final int contentLength; |
| 23 |
| 24 // TODO(nweiz): automatically parse cookies from headers |
| 25 |
| 26 // TODO(nweiz): make this a HttpHeaders object. |
| 27 /// The headers for this response. |
| 28 final Map<String, String> headers; |
| 29 |
| 30 /// Whether this response is a redirect. |
| 31 final bool isRedirect; |
| 32 |
| 33 /// Whether the server requested that a persistent connection be maintained. |
| 34 final bool persistentConnection; |
| 35 |
| 36 /// Creates a new HTTP response. |
| 37 BaseResponse( |
| 38 this.statusCode, |
| 39 this.contentLength, |
| 40 {this.headers: const <String>{}, |
| 41 this.isRedirect: false, |
| 42 this.persistentConnection: true, |
| 43 this.reasonPhrase}); |
| 44 } |
| OLD | NEW |