Bug: HTMXRequest
not passed to exception handlers, only gets access to standard Request
object
#2399
Closed
1 of 4 tasks
Labels
Description
I am trying to handle exceptions caused during HTMX requests. But it looks like the exception handler only receives a standard
request
object, even when the routes are set to receive anHTMXRequest
.In the exception handler, the only flag I can find to indicate it's an HTMX request is
request._headers.get("hx-request")
. We lose context on all other HTMX attributes in the request, which makes it difficult to troubleshoot and handle nicely.Having access to the original HTMX request attributes can improve the flexibility of exception handling for these cases.
URL to code causing the issue
No response
MCVE
Steps to reproduce
Screenshots
No response
Logs
No response
Litestar Version
Litestar
2.1.1
and Python3.11.5
Platform
Funding
The text was updated successfully, but these errors were encountered: