OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library base_response; | |
6 | |
7 import 'base_request.dart'; | 5 import 'base_request.dart'; |
8 | 6 |
9 /// The base class for HTTP responses. | 7 /// The base class for HTTP responses. |
10 /// | 8 /// |
11 /// Subclasses of [BaseResponse] are usually not constructed manually; instead, | 9 /// Subclasses of [BaseResponse] are usually not constructed manually; instead, |
12 /// they're returned by [BaseClient.send] or other HTTP client methods. | 10 /// they're returned by [BaseClient.send] or other HTTP client methods. |
13 abstract class BaseResponse { | 11 abstract class BaseResponse { |
14 /// The (frozen) request that triggered this response. | 12 /// The (frozen) request that triggered this response. |
15 final BaseRequest request; | 13 final BaseRequest request; |
16 | 14 |
(...skipping 29 matching lines...) Expand all Loading... |
46 this.isRedirect: false, | 44 this.isRedirect: false, |
47 this.persistentConnection: true, | 45 this.persistentConnection: true, |
48 this.reasonPhrase}) { | 46 this.reasonPhrase}) { |
49 if (statusCode < 100) { | 47 if (statusCode < 100) { |
50 throw new ArgumentError("Invalid status code $statusCode."); | 48 throw new ArgumentError("Invalid status code $statusCode."); |
51 } else if (contentLength != null && contentLength < 0) { | 49 } else if (contentLength != null && contentLength < 0) { |
52 throw new ArgumentError("Invalid content length $contentLength."); | 50 throw new ArgumentError("Invalid content length $contentLength."); |
53 } | 51 } |
54 } | 52 } |
55 } | 53 } |
OLD | NEW |