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

Side by Side Diff: pkg/shelf/test/request_test.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/response.dart ('k') | pkg/shelf/test/response_test.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_test; 5 library shelf.request_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:shelf/shelf.dart'; 10 import 'package:shelf/shelf.dart';
11 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
12 12
13 Request _request([Map<String, String> headers, Stream<List<int>> body]) { 13 Request _request([Map<String, String> headers, Stream<List<int>> body,
14 Map<String, Object> context]) {
14 if (headers == null) headers = {}; 15 if (headers == null) headers = {};
15 return new Request("/", "", "GET", "", "1.1", Uri.parse('http://localhost/'), 16 return new Request("/", "", "GET", "", "1.1", Uri.parse('http://localhost/'),
16 headers, body: body); 17 headers, body: body, context: context);
17 } 18 }
18 19
19 void main() { 20 void main() {
20 group("contentLength", () { 21 group("contentLength", () {
21 test("is null without a content-length header", () { 22 test("is null without a content-length header", () {
22 var request = _request(); 23 var request = _request();
23 expect(request.contentLength, isNull); 24 expect(request.contentLength, isNull);
24 }); 25 });
25 26
26 test("comes from the content-length header", () { 27 test("comes from the content-length header", () {
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 'content-type': 'text/plain; charset=fblthp' 141 'content-type': 'text/plain; charset=fblthp'
141 }).encoding, isNull); 142 }).encoding, isNull);
142 }); 143 });
143 144
144 test("comes from the content-type charset parameter", () { 145 test("comes from the content-type charset parameter", () {
145 expect(_request({ 146 expect(_request({
146 'content-type': 'text/plain; charset=iso-8859-1' 147 'content-type': 'text/plain; charset=iso-8859-1'
147 }).encoding, equals(LATIN1)); 148 }).encoding, equals(LATIN1));
148 }); 149 });
149 }); 150 });
151
152 group("context", () {
153 test("are correctly populated", () {
154 expect(_request({
155 'content-type': 'text/plain'
156 }, null, {
157 'my-param' : 42
158 }).context['my-param'], equals(42));
159 });
160 });
150 } 161 }
OLDNEW
« no previous file with comments | « pkg/shelf/lib/src/response.dart ('k') | pkg/shelf/test/response_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698