-
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
feat: Uri parameters in vars expression #142
base: master
Are you sure you want to change the base?
Conversation
This will allow us to use the matched params as part of the vars later.
This adds `uri_param_<name>` allowing vars and filters access to the parameters of a uri. By doing this we are able to improve validation of routes to specific params.
As match_route_opts now handles both the opts and params we can set the matched information in match_route_opts to avoid some duplicate code.
It seems `setmetatable` is very slow and was destroying the benchmark. For this reason we now use `clone_tab` and add the uri matches.
No need to capture this data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI failed of master branch, we need to fix it first.
I have created an issue: #143
There is no need to return `nil` as this is the default so let's avoid adding it.
@boekkooi-lengoo I have helped you to rerun the CI, the test cases had passed. You can continue this PR |
Hey @membphis Could you maybe review the code and let me know if it requires some changes before I write the docs? Thanks in advance! |
will do this tomorrow |
sorry for my late reply, it take me more time to read and test your code, they are all fine to me |
[table.clone](https://github.com/openresty/luajit2#tableclone) won't copy metamethods. So in order to avoid any issues the [__index](https://www.lua.org/pil/13.4.1.html) metamethod is added to the new ops_vars.
This PR is a spin-off from #141 as the implementation differs a lot but causes the same effect.