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

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

Issue 223023003: Extract an http_parser package from shelf. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review 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/request.dart ('k') | pkg/shelf/lib/src/util.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.response; 5 library shelf.response;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:collection/wrappers.dart'; 10 import 'package:collection/wrappers.dart';
11 import 'package:http_parser/http_parser.dart';
11 12
12 import 'media_type.dart';
13 import 'message.dart'; 13 import 'message.dart';
14 import 'util.dart';
15 14
16 /// The response returned by a [Handler]. 15 /// The response returned by a [Handler].
17 class Response extends Message { 16 class Response extends Message {
18 /// The HTTP status code of the response. 17 /// The HTTP status code of the response.
19 final int statusCode; 18 final int statusCode;
20 19
21 /// The date and time after which the response's data should be considered 20 /// The date and time after which the response's data should be considered
22 /// stale. 21 /// stale.
23 /// 22 ///
24 /// This is parsed from the Expires header in [headers]. If [headers] doesn't 23 /// This is parsed from the Expires header in [headers]. If [headers] doesn't
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 /// Converts [location], which may be a [String] or a [Uri], to a [String]. 263 /// Converts [location], which may be a [String] or a [Uri], to a [String].
265 /// 264 ///
266 /// Throws an [ArgumentError] if [location] isn't a [String] or a [Uri]. 265 /// Throws an [ArgumentError] if [location] isn't a [String] or a [Uri].
267 String _locationToString(location) { 266 String _locationToString(location) {
268 if (location is String) return location; 267 if (location is String) return location;
269 if (location is Uri) return location.toString(); 268 if (location is Uri) return location.toString();
270 269
271 throw new ArgumentError('Response location must be a String or Uri, was ' 270 throw new ArgumentError('Response location must be a String or Uri, was '
272 '"$location".'); 271 '"$location".');
273 } 272 }
OLDNEW
« no previous file with comments | « pkg/shelf/lib/src/request.dart ('k') | pkg/shelf/lib/src/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698