Merge pull request #160 from Cohors1316/main

Switched HX-Target header to HX-Request in HtmxMiddleware
This commit is contained in:
bobf 2025-02-19 08:15:57 +00:00 committed by GitHub
commit 8a4f91f26a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,10 +8,10 @@ const HtmxMiddleware = @This();
/// request doesn't come via htmx and, when the request does come from htmx, only return the
/// content rendered directly by the view function.
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(
"[middleware-htmx] htmx request detected, disabling layout. (#{s})",
.{target},
"[middleware-htmx] HX-Request header, disabling layout.",
.{},
);
request.setLayout(null);
}