From 47001c33039e6915f12b95a3e948caae6cf21d41 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 4 Mar 2019 20:11:43 -0800 Subject: api_router - allow parameters as final path argument --- Zotlabs/Lib/Api_router.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Api_router.php b/Zotlabs/Lib/Api_router.php index 404678bd9..6e3f231a9 100644 --- a/Zotlabs/Lib/Api_router.php +++ b/Zotlabs/Lib/Api_router.php @@ -12,8 +12,16 @@ class Api_router { } static function find($path) { - if(array_key_exists($path,self::$routes)) + if (array_key_exists($path,self::$routes)) { return self::$routes[$path]; + } + + $with_params = dirname($path) . '/[id]'; + + if (array_key_exists($with_params,self::$routes)) { + return self::$routes[$with_params]; + } + return null; } -- cgit v1.2.3