Skip to content

When use lucky with htmx, i found my project use context.request.query_params a lot, do we consider add a view helper method? #1884

Discussion options

You must be logged in to vote

Using context.request.query_params directly isn't really safe since there's no sanitization happening, and you're not guaranteed to get the proper type you're looking for. In this case you'd really want to take advantage of using expose https://luckyframework.org/guides/frontend/rendering-html#example-using-needs-and-expose

That way you can set your params with type-safety like param param1 : Int32. For your case, if you just need the escape hatch, then I'd suggest making a helper method in your MainLayout or in a mixin that can be included in your pages and components.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by zw963
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants