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

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

Issue 837193005: pkg/shelf: formatted code (Closed) Base URL: https://github.com/dart-lang/shelf.git@master
Patch Set: nits Created 5 years, 11 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/shelf_io.dart ('k') | lib/src/handlers/logger.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.cascade; 5 library shelf.cascade;
6 6
7 import 'handler.dart'; 7 import 'handler.dart';
8 import 'response.dart'; 8 import 'response.dart';
9 import 'util.dart'; 9 import 'util.dart';
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 return syncFuture(() => _parent.handler(request)).then((response) { 74 return syncFuture(() => _parent.handler(request)).then((response) {
75 if (_shouldCascade(response)) return _handler(request); 75 if (_shouldCascade(response)) return _handler(request);
76 return response; 76 return response;
77 }); 77 });
78 }; 78 };
79 } 79 }
80 } 80 }
81 81
82 /// Computes the [Cascade._shouldCascade] function based on the user's 82 /// Computes the [Cascade._shouldCascade] function based on the user's
83 /// parameters. 83 /// parameters.
84 Function _computeShouldCascade(Iterable<int> statusCodes, 84 Function _computeShouldCascade(
85 Function shouldCascade) { 85 Iterable<int> statusCodes, Function shouldCascade) {
86 if (shouldCascade != null) return shouldCascade; 86 if (shouldCascade != null) return shouldCascade;
87 if (statusCodes == null) statusCodes = [404, 405]; 87 if (statusCodes == null) statusCodes = [404, 405];
88 statusCodes = statusCodes.toSet(); 88 statusCodes = statusCodes.toSet();
89 return (response) => statusCodes.contains(response.statusCode); 89 return (response) => statusCodes.contains(response.statusCode);
90 } 90 }
OLDNEW
« no previous file with comments | « lib/shelf_io.dart ('k') | lib/src/handlers/logger.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698