mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-14 22:16:08 +00:00
Merge pull request #160 from Cohors1316/main
Switched HX-Target header to HX-Request in HtmxMiddleware
This commit is contained in:
commit
8a4f91f26a
@ -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