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

Side by Side Diff: pkg/shelf/lib/src/message.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/media_type.dart ('k') | pkg/shelf/lib/src/request.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.message; 5 library shelf.message;
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 import 'package:stack_trace/stack_trace.dart'; 12 import 'package:stack_trace/stack_trace.dart';
12 13
13 import 'media_type.dart';
14
15 /// Represents logic shared between [Request] and [Response]. 14 /// Represents logic shared between [Request] and [Response].
16 abstract class Message { 15 abstract class Message {
17 /// The HTTP headers. 16 /// The HTTP headers.
18 /// 17 ///
19 /// The value is immutable. 18 /// The value is immutable.
20 final Map<String, String> headers; 19 final Map<String, String> headers;
21 20
22 /// The streaming body of the message. 21 /// The streaming body of the message.
23 /// 22 ///
24 /// This can be read via [read] or [readAsString]. 23 /// This can be read via [read] or [readAsString].
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 /// Otherwise the encoding is taken from the Content-Type header. If that 85 /// Otherwise the encoding is taken from the Content-Type header. If that
87 /// doesn't exist or doesn't have a "charset" parameter, UTF-8 is used. 86 /// doesn't exist or doesn't have a "charset" parameter, UTF-8 is used.
88 /// 87 ///
89 /// This calls [read] internally, which can only be called once. 88 /// This calls [read] internally, which can only be called once.
90 Future<String> readAsString([Encoding encoding]) { 89 Future<String> readAsString([Encoding encoding]) {
91 if (encoding == null) encoding = this.encoding; 90 if (encoding == null) encoding = this.encoding;
92 if (encoding == null) encoding = UTF8; 91 if (encoding == null) encoding = UTF8;
93 return Chain.track(encoding.decodeStream(read())); 92 return Chain.track(encoding.decodeStream(read()));
94 } 93 }
95 } 94 }
OLDNEW
« no previous file with comments | « pkg/shelf/lib/src/media_type.dart ('k') | pkg/shelf/lib/src/request.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698