Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: pkg/http/lib/src/base_response.dart

Issue 810223002: Remove the http package from the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 'base_request.dart';
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 (frozen) request that triggered this response.
15 final BaseRequest request;
16
17 /// The status code of the response.
18 final int statusCode;
19
20 /// The reason phrase associated with the status code.
21 final String reasonPhrase;
22
23 /// The size of the response body, in bytes.
24 ///
25 /// If the size of the request is not known in advance, this is `null`.
26 final int contentLength;
27
28 // TODO(nweiz): automatically parse cookies from headers
29
30 // TODO(nweiz): make this a HttpHeaders object.
31 /// The headers for this response.
32 final Map<String, String> headers;
33
34 /// Whether this response is a redirect.
35 final bool isRedirect;
36
37 /// Whether the server requested that a persistent connection be maintained.
38 final bool persistentConnection;
39
40 /// Creates a new HTTP response.
41 BaseResponse(
42 this.statusCode,
43 {this.contentLength,
44 this.request,
45 this.headers: const {},
46 this.isRedirect: false,
47 this.persistentConnection: true,
48 this.reasonPhrase}) {
49 if (statusCode < 100) {
50 throw new ArgumentError("Invalid status code $statusCode.");
51 } else if (contentLength != null && contentLength < 0) {
52 throw new ArgumentError("Invalid content length $contentLength.");
53 }
54 }
55 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698