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

Unified Diff: pkg/shelf/lib/src/message.dart

Issue 232073005: Addressed comments from review https://codereview.chromium.org/226263007 Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months 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 | « no previous file | pkg/shelf/lib/src/request.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/shelf/lib/src/message.dart
diff --git a/pkg/shelf/lib/src/message.dart b/pkg/shelf/lib/src/message.dart
index ad64d10ea31604ae930400e60e4cb3955ffcbc5d..693f21a53177fc85a5c82eba281b59c69e68a687 100644
--- a/pkg/shelf/lib/src/message.dart
+++ b/pkg/shelf/lib/src/message.dart
@@ -25,11 +25,22 @@ abstract class Message {
/// This can be read via [read] or [readAsString].
final Stream<List<int>> _body;
+ /// Extra context parameters for handlers to pass data to subsequent handlers.
+ /// Note: for requests this means downstream handlers.
+ /// For responses this means upstream handlers.
+ ///
+ /// The value is immutable.
+ final Map<String, Object> context;
+
+
/// Creates a new [Message].
///
/// If [headers] is `null`, it is treated as empty.
- Message(this._body, {Map<String, String> headers})
- : this.headers = _getIgnoreCaseMapView(headers);
+ /// If [context] is `null`, it is treated as empty.
+ Message(this._body, {Map<String, String> headers,
+ Map<String, Object> context : const {}})
+ : this.headers = _getIgnoreCaseMapView(headers),
+ this.context = context;
/// The contents of the content-length field in [headers].
///
« no previous file with comments | « no previous file | pkg/shelf/lib/src/request.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698