OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 test.util.path_handler; | 5 library test.util.path_handler; |
6 | 6 |
7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
8 import 'package:shelf/shelf.dart' as shelf; | 8 import 'package:shelf/shelf.dart' as shelf; |
9 | 9 |
10 import '../utils.dart'; | 10 import '../utils.dart'; |
(...skipping 29 matching lines...) Expand all Loading... |
40 node = node.children[components[i]]; | 40 node = node.children[components[i]]; |
41 if (node == null) break; | 41 if (node == null) break; |
42 if (node.handler == null) continue; | 42 if (node.handler == null) continue; |
43 handler = node.handler; | 43 handler = node.handler; |
44 handlerIndex = i; | 44 handlerIndex = i; |
45 } | 45 } |
46 | 46 |
47 if (handler == null) return new shelf.Response.notFound("Not found."); | 47 if (handler == null) return new shelf.Response.notFound("Not found."); |
48 | 48 |
49 return handler(shelfChange(request, | 49 return handler(shelfChange(request, |
50 path: p.joinAll(components.take(handlerIndex + 1)))); | 50 path: p.url.joinAll(components.take(handlerIndex + 1)))); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 /// A trie node. | 54 /// A trie node. |
55 class _Node { | 55 class _Node { |
56 shelf.Handler handler; | 56 shelf.Handler handler; |
57 final children = new Map<String, _Node>(); | 57 final children = new Map<String, _Node>(); |
58 } | 58 } |
OLD | NEW |