OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import 'package:async/async.dart'; | 9 import 'package:async/async.dart'; |
10 import 'package:http_multi_server/http_multi_server.dart'; | 10 import 'package:http_multi_server/http_multi_server.dart'; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 .add(_jsHandler.handler) | 126 .add(_jsHandler.handler) |
127 .add(createStaticHandler(_root)) | 127 .add(createStaticHandler(_root)) |
128 .add(_wrapperHandler); | 128 .add(_wrapperHandler); |
129 | 129 |
130 if (config.precompiledPath != null) { | 130 if (config.precompiledPath != null) { |
131 cascade = cascade.add(createStaticHandler(config.precompiledPath)); | 131 cascade = cascade.add(createStaticHandler(config.precompiledPath)); |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 var pipeline = new shelf.Pipeline() | 135 var pipeline = new shelf.Pipeline() |
136 .addMiddleware(nestingMiddleware(_secret)) | 136 .addMiddleware(PathHandler.nestedIn(_secret)) |
137 .addHandler(cascade.handler); | 137 .addHandler(cascade.handler); |
138 | 138 |
139 _server.mount(pipeline); | 139 _server.mount(pipeline); |
140 } | 140 } |
141 | 141 |
142 /// A handler that serves wrapper files used to bootstrap tests. | 142 /// A handler that serves wrapper files used to bootstrap tests. |
143 shelf.Response _wrapperHandler(shelf.Request request) { | 143 shelf.Response _wrapperHandler(shelf.Request request) { |
144 var path = p.fromUri(request.url); | 144 var path = p.fromUri(request.url); |
145 | 145 |
146 if (path.endsWith(".browser_test.dart")) { | 146 if (path.endsWith(".browser_test.dart")) { |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 await Future.wait(futures); | 418 await Future.wait(futures); |
419 | 419 |
420 if (_config.pubServeUrl == null) { | 420 if (_config.pubServeUrl == null) { |
421 new Directory(_compiledDir).deleteSync(recursive: true); | 421 new Directory(_compiledDir).deleteSync(recursive: true); |
422 } else { | 422 } else { |
423 _http.close(); | 423 _http.close(); |
424 } | 424 } |
425 }); | 425 }); |
426 final _closeMemo = new AsyncMemoizer(); | 426 final _closeMemo = new AsyncMemoizer(); |
427 } | 427 } |
OLD | NEW |