Chromium Code Reviews| 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 /// | |
| 38 /// This should not be called directly. Only subclasses should be constructed. | |
|
Bob Nystrom
2012/10/31 01:17:44
You can remove this comment.
nweiz
2012/10/31 18:20:59
Done.
| |
| 39 BaseResponse( | |
| 40 this.statusCode, | |
| 41 this.contentLength, | |
| 42 {this.headers: const <String>{}, | |
|
Bob Nystrom
2012/11/01 19:53:59
Hmm, does this mean that if you don't provide any
nweiz
2012/11/02 19:29:12
Yes, that's intended. A response is supposed to be
| |
| 43 this.isRedirect: false, | |
| 44 this.persistentConnection: true, | |
| 45 this.reasonPhrase: null}); | |
|
Bob Nystrom
2012/10/31 01:17:44
Ditch ": null".
nweiz
2012/10/31 18:20:59
Done.
| |
| 46 } | |
| OLD | NEW |