-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
request help: Parameters in path #56
Comments
@Gary-Airwallex we can talk it here. I think that is a bug. we need to fix it. |
I did some research about We support And here is the Chinese article: https://studygolang.com/articles/29177 // 例子3. 带星号(*)模糊匹配参数的url路径
// 星号代表匹配任意路径的意思, 必须在*号后面指定一个参数名,后面可以通过这个参数获取*号匹配的内容。
//以/foods/ 开头的所有路径都匹配
//匹配:/foods/1, /foods/200, /foods/1/20, /foods/apple/1
/foods/*path
//可以通过path参数获取*号匹配的内容。 // (*) URL path of fuzzy matching parameters
// (*) means to allow any path,
// here is some example, route: /foods/*path
// will match all of them:
/foods/1, /foods/200, /foods/1/20, /foods/apple/1
// and we can get the matched value by name `path` |
I think that is a wrong example.
So, |
Ok I see. Double checked in radixtree 2.2 with APISIX 1.5, seems like "/abc/*id" is rejecting requests "/abc" or "/abc/", which should be accepted according to the Gin docs (it might have something to do with APISIX's behavior on trailing slash?). |
Is there any plan on supporting optional parameter as described in my example? (Such that both "/foo/bar" are "/foo/1/bar" by uri "/foo/SOME_OPTIONAL_PARAMETER/bar") It's not a must-have feature for us currently, but I think it'd be sweet to have it. |
We do not have any plans for this case. I think we support Gin way is power enough. ^_^ |
original issue: apache/apisix#2058 (comment)
For the "*" syntax, my understanding is that "*action" is an optional parameter. For example if we configure "uri": "/:id/foo/action/bar" in APISIX, both requests "/1/foo/get/bar" and "/2/foo/bar" should be matched by the route, while request "/3/foo/a/b/bar" should be rejected. However in APISIX the "" syntax has similar behavior with the colon syntax. The tests 7, 8 here https://github.com/api7/lua-resty-radixtree/blob/master/t/parameter.t seems broken: they are named "/name/*name/foo" but tested with "/name/:name/foo"
The text was updated successfully, but these errors were encountered: