| Index: lib/src/util/one_off_handler.dart
|
| diff --git a/lib/src/util/one_off_handler.dart b/lib/src/util/one_off_handler.dart
|
| index 9994f46ac26cf79246f7025e20333d208d28ad1e..069d6818875d0d4028f022be2d5060cd2537d61a 100644
|
| --- a/lib/src/util/one_off_handler.dart
|
| +++ b/lib/src/util/one_off_handler.dart
|
| @@ -36,8 +36,14 @@ class OneOffHandler {
|
|
|
| /// Dispatches [request] to the appropriate handler.
|
| _onRequest(shelf.Request request) {
|
| - // Skip the first component because it's always "/".
|
| - var components = p.url.split(request.url.path).skip(1).toList();
|
| + var components = p.url.split(request.url.path);
|
| +
|
| + // For shelf < 0.6.0, the first component of the path is always "/". We can
|
| + // safely skip it.
|
| + if (components.isNotEmpty && components.first == "/") {
|
| + components.removeAt(0);
|
| + }
|
| +
|
| if (components.isEmpty) return new shelf.Response.notFound(null);
|
|
|
| var handler = _handlers.remove(components.removeAt(0));
|
|
|