-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
docs(htmx): add request_class to example #3725
Conversation
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.
Thank you for your contribution 🙂
I am afraid you must have overlooked this. As shown in https://docs.litestar.dev/latest/usage/htmx.html#htmxrequest, request_class=HTMXRequest
is set at the app layer and hence is not needed to be specified at any other layers.
app = Litestar(
route_handlers=[get_form],
debug=True,
request_class=HTMXRequest,
template_config=TemplateConfig(
directory=Path("litestar_htmx/templates"),
engine=JinjaTemplateEngine,
),
)
In place of your current suggestion, maybe a line (or two) that signifies this can be added?
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.
as @Alc-Alc mentioned
Are you suggesting like a comment within the code that the |
Heya @yujinyuz, I am suggesting the following A special :class:`~litestar.connection.Request` class, providing interaction with the
HTMX client. For a request to be considered an :class:`~litestar.contrib.htmx.request.HTMXRequest`, set ``request_class=HTMXRequest``
at a preferred layer (app / router / controller / handler). over here Lines 6 to 10 in 47c09ff
Feel free to rephrase or even rework that sentence, my suggestion is for the intent to be clear. The intent being, "add @JacobCoffee FYI. |
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3725 |
There are some updates coming to the HTMX documentation in this PR #3837 Before I'd seen this, I updated the verbiage slightly to say you can add the |
Description
This just adds the request_class into the example provided in the htmx section. I was just following the example and encountered an error.
Closes
#3723