Skip to content
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 #2058

Closed
Gary-Airwallex opened this issue Aug 14, 2020 · 3 comments · Fixed by api7/lua-resty-radixtree#52 or #2061
Closed

request help: Parameters in path #2058

Gary-Airwallex opened this issue Aug 14, 2020 · 3 comments · Fixed by api7/lua-resty-radixtree#52 or #2061
Labels
bug Something isn't working

Comments

@Gary-Airwallex
Copy link
Contributor

Gary-Airwallex commented Aug 14, 2020

Issue description

https://github.com/gin-gonic/gin#parameters-in-path described a ":" syntax and an "*" syntax for parameters in path, I believe radixtree (and therefore APISIX) intended to support both.

For the ":" syntax, currently APISIX seems to accept ANY string. For example, request "/a/b/c/foo" seems to be accepted by "uri": "/:id/foo". I'm not sure if that's the expected behavior: matching ":id" with non-slash character sounds more natural to me (something like "[^/]+").

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"

Environment

  • apisix version (cmd: apisix version): 1.5, with radixtree 2.1
  • OS: osx 10.15
@membphis membphis added the bug Something isn't working label Aug 14, 2020
@membphis
Copy link
Member

we may fix this bug in resty-radixtree

@Gary-Airwallex
Copy link
Contributor Author

@membphis Looks like the second issue (about the asterisk "*" syntax, denoting an optional parameter I believe) is not addressed in radixtree 2.2; could you re-open the issue?

@membphis
Copy link
Member

@membphis Looks like the second issue (about the asterisk "*" syntax, denoting an optional parameter I believe) is not addressed in radixtree 2.2; could you re-open the issue?

I created a new issue at resty-radixtree: api7/lua-resty-radixtree#56
we can fix it later.

one issue for one bug, it is easier to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants