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

Side by Side Diff: pkg/shelf/lib/src/request.dart

Issue 226263007: issue 17992 Added extra params to message (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: review updates. Renamed extraParams to context. Updated comment 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/shelf/lib/src/message.dart ('k') | pkg/shelf/lib/src/response.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 shelf.request; 5 library shelf.request;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 // TODO(kevmoo): use UnmodifiableMapView from SDK once 1.4 ships 10 // TODO(kevmoo): use UnmodifiableMapView from SDK once 1.4 ships
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 DateTime get ifModifiedSince { 61 DateTime get ifModifiedSince {
62 if (_ifModifiedSinceCache != null) return _ifModifiedSinceCache; 62 if (_ifModifiedSinceCache != null) return _ifModifiedSinceCache;
63 if (!headers.containsKey('if-modified-since')) return null; 63 if (!headers.containsKey('if-modified-since')) return null;
64 _ifModifiedSinceCache = parseHttpDate(headers['if-modified-since']); 64 _ifModifiedSinceCache = parseHttpDate(headers['if-modified-since']);
65 return _ifModifiedSinceCache; 65 return _ifModifiedSinceCache;
66 } 66 }
67 DateTime _ifModifiedSinceCache; 67 DateTime _ifModifiedSinceCache;
68 68
69 Request(this.pathInfo, String queryString, this.method, 69 Request(this.pathInfo, String queryString, this.method,
70 this.scriptName, this.protocolVersion, this.requestedUri, 70 this.scriptName, this.protocolVersion, this.requestedUri,
71 Map<String, String> headers, {Stream<List<int>> body}) 71 Map<String, String> headers, {Stream<List<int>> body,
72 Map<String, Object> context})
72 : this.queryString = queryString == null ? '' : queryString, 73 : this.queryString = queryString == null ? '' : queryString,
73 super(new pc.UnmodifiableMapView(new HashMap.from(headers)), 74 super(new pc.UnmodifiableMapView(new HashMap.from(headers)),
74 body == null ? new Stream.fromIterable([]) : body) { 75 body == null ? new Stream.fromIterable([]) : body,
76 new pc.UnmodifiableMapView(new HashMap.from(
77 context != null ? context: {}))) {
75 if (method.isEmpty) throw new ArgumentError('method cannot be empty.'); 78 if (method.isEmpty) throw new ArgumentError('method cannot be empty.');
76 79
77 if (scriptName.isNotEmpty && !scriptName.startsWith('/')) { 80 if (scriptName.isNotEmpty && !scriptName.startsWith('/')) {
78 throw new ArgumentError('scriptName must be empty or start with "/".'); 81 throw new ArgumentError('scriptName must be empty or start with "/".');
79 } 82 }
80 83
81 if (scriptName == '/') { 84 if (scriptName == '/') {
82 throw new ArgumentError( 85 throw new ArgumentError(
83 'scriptName can never be "/". It should be empty instead.'); 86 'scriptName can never be "/". It should be empty instead.');
84 } 87 }
(...skipping 14 matching lines...) Expand all
99 /// Convenience property to access [pathInfo] data as a [List]. 102 /// Convenience property to access [pathInfo] data as a [List].
100 List<String> get pathSegments { 103 List<String> get pathSegments {
101 var segs = p.url.split(pathInfo); 104 var segs = p.url.split(pathInfo);
102 if (segs.length > 0) { 105 if (segs.length > 0) {
103 assert(segs.first == p.url.separator); 106 assert(segs.first == p.url.separator);
104 segs.removeAt(0); 107 segs.removeAt(0);
105 } 108 }
106 return segs; 109 return segs;
107 } 110 }
108 } 111 }
OLDNEW
« no previous file with comments | « pkg/shelf/lib/src/message.dart ('k') | pkg/shelf/lib/src/response.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698