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

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

Issue 1327453002: Share a body across all versions of a message. (Closed) Base URL: git@github.com:dart-lang/shelf@master
Patch Set: Code review changes Created 5 years, 3 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
« no previous file with comments | « lib/src/message.dart ('k') | 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:convert'; 8 import 'dart:convert';
9 9
10 import 'package:http_parser/http_parser.dart'; 10 import 'package:http_parser/http_parser.dart';
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 /// print(request.url); // => dir/file.html 203 /// print(request.url); // => dir/file.html
204 /// 204 ///
205 /// request = request.change(path: "dir"); 205 /// request = request.change(path: "dir");
206 /// print(request.handlerPath); // => /static/dir/ 206 /// print(request.handlerPath); // => /static/dir/
207 /// print(request.url); // => file.html 207 /// print(request.url); // => file.html
208 Request change({Map<String, String> headers, Map<String, Object> context, 208 Request change({Map<String, String> headers, Map<String, Object> context,
209 String path, body}) { 209 String path, body}) {
210 headers = updateMap(this.headers, headers); 210 headers = updateMap(this.headers, headers);
211 context = updateMap(this.context, context); 211 context = updateMap(this.context, context);
212 212
213 if (body == null) body = this.read(); 213 if (body == null) body = getBody(this);
214 214
215 var handlerPath = this.handlerPath; 215 var handlerPath = this.handlerPath;
216 if (path != null) handlerPath += path; 216 if (path != null) handlerPath += path;
217 217
218 return new Request._(this.method, this.requestedUri, 218 return new Request._(this.method, this.requestedUri,
219 protocolVersion: this.protocolVersion, 219 protocolVersion: this.protocolVersion,
220 headers: headers, 220 headers: headers,
221 handlerPath: handlerPath, 221 handlerPath: handlerPath,
222 body: body, 222 body: body,
223 context: context, 223 context: context,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 return handlerPath; 346 return handlerPath;
347 } else if (url != null) { 347 } else if (url != null) {
348 if (url.path.isEmpty) return requestedUri.path; 348 if (url.path.isEmpty) return requestedUri.path;
349 349
350 var index = requestedUri.path.indexOf(url.path); 350 var index = requestedUri.path.indexOf(url.path);
351 return requestedUri.path.substring(0, index); 351 return requestedUri.path.substring(0, index);
352 } else { 352 } else {
353 return '/'; 353 return '/';
354 } 354 }
355 } 355 }
OLDNEW
« no previous file with comments | « lib/src/message.dart ('k') | lib/src/response.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698