mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-14 22:16:08 +00:00
Switched HX-Target header to HX-Request
Using a target like `hx-target="next div"` will not generate an HX-Target header if the target element does not have an ID. Judging by the comments it used to be HX-Request.
This commit is contained in:
parent
da2978ed04
commit
0a4690e001
@ -8,10 +8,10 @@ const HtmxMiddleware = @This();
|
|||||||
/// request doesn't come via htmx and, when the request does come from htmx, only return the
|
/// request doesn't come via htmx and, when the request does come from htmx, only return the
|
||||||
/// content rendered directly by the view function.
|
/// content rendered directly by the view function.
|
||||||
pub fn afterRequest(request: *jetzig.http.Request) !void {
|
pub fn afterRequest(request: *jetzig.http.Request) !void {
|
||||||
if (request.headers.get("HX-Target")) |target| {
|
if (request.headers.get("HX-Request")) |_| {
|
||||||
try request.server.logger.DEBUG(
|
try request.server.logger.DEBUG(
|
||||||
"[middleware-htmx] htmx request detected, disabling layout. (#{s})",
|
"[middleware-htmx] HX-Request header, disabling layout.",
|
||||||
.{target},
|
.{},
|
||||||
);
|
);
|
||||||
request.setLayout(null);
|
request.setLayout(null);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user