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

Unified Diff: lib/src/util/one_off_handler.dart

Issue 1057653002: Add support for shelf 0.6.0. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698