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

Unified Diff: pkg/http/lib/src/base_response.dart

Issue 11363063: Add an HTTP library that wraps dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/http/lib/src/base_request.dart ('k') | pkg/http/lib/src/client.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/http/lib/src/base_response.dart
diff --git a/pkg/http/lib/src/base_response.dart b/pkg/http/lib/src/base_response.dart
new file mode 100644
index 0000000000000000000000000000000000000000..57f4a95b9d578c7e825d59d0cd77210214f14f44
--- /dev/null
+++ b/pkg/http/lib/src/base_response.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library base_response;
+
+import 'dart:io';
+
+/// 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 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.headers: const <String>{},
+ this.isRedirect: false,
+ this.persistentConnection: true,
+ this.reasonPhrase});
+}
« no previous file with comments | « pkg/http/lib/src/base_request.dart ('k') | pkg/http/lib/src/client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698