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

Side by Side Diff: pkg/scheduled_test/lib/scheduled_server.dart

Issue 227563010: pkg/shelf: case-insensitive headers, cleaner Request ctor, a lot more tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixing dependent code, changelog 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 | « no previous file | pkg/scheduled_test/lib/scheduled_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 scheduled_test.scheduled_server; 5 library scheduled_test.scheduled_server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 /// The handler for incoming [shelf.Request]s to this server. 83 /// The handler for incoming [shelf.Request]s to this server.
84 /// 84 ///
85 /// This dispatches the request to the first handler in the queue. It's that 85 /// This dispatches the request to the first handler in the queue. It's that
86 /// handler's responsibility to check that the method/path are correct and 86 /// handler's responsibility to check that the method/path are correct and
87 /// that it's being run at the correct time. 87 /// that it's being run at the correct time.
88 Future<shelf.Response> _handleRequest(shelf.Request request) { 88 Future<shelf.Response> _handleRequest(shelf.Request request) {
89 return wrapFuture(syncFuture(() { 89 return wrapFuture(syncFuture(() {
90 if (_handlers.isEmpty) { 90 if (_handlers.isEmpty) {
91 fail("'$description' received ${request.method} ${request.pathInfo} " 91 fail("'$description' received ${request.method} ${request.url.path} "
92 "when no more requests were expected."); 92 "when no more requests were expected.");
93 } 93 }
94 return _handlers.removeFirst().fn(request); 94 return _handlers.removeFirst().fn(request);
95 }), 'receiving ${request.method} ${request.pathInfo}').catchError((error) { 95 }), 'receiving ${request.method} ${request.url.path}').catchError((error) {
96 // Don't let errors bubble up to the shelf handler. It will print them to 96 // Don't let errors bubble up to the shelf handler. It will print them to
97 // stderr, but the user will already be notified via the scheduled_test 97 // stderr, but the user will already be notified via the scheduled_test
98 // infrastructure. 98 // infrastructure.
99 return new shelf.Response.internalServerError( 99 return new shelf.Response.internalServerError(
100 body: error.toString(), 100 body: error.toString(),
101 headers: {'content-type': 'text/plain'}); 101 headers: {'content-type': 'text/plain'});
102 }); 102 });
103 } 103 }
104 } 104 }
OLDNEW
« no previous file with comments | « no previous file | pkg/scheduled_test/lib/scheduled_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698