Add simple "any" route to catch any method

This commit is contained in:
Alex Hultman
2019-01-22 13:55:28 +01:00
parent 6d469cd8ba
commit f4065b4e3b
3 changed files with 17 additions and 5 deletions
+10 -2
View File
@@ -154,9 +154,17 @@ private:
}
if (parent != &tree) {
return matchUrlSegment(parent, 0);
int handler = matchUrlSegment(parent, 0);
/* We failed to match */
if (!handler && method.length() > 1) {
return lookupNew("*", url);
}
return handler;
} else {
return 0;
/* Unhandled, check if we have any "all" route for this url */
return method.length() == 1 ? 0 : lookupNew("*", url);
}
}