Files
James BarlowandClaude Opus 4.7 6248b6f19e fix: prevent partial response-header match TypeError (#527) (#3772)
hasHeader() tested a regex against getAllResponseHeaders() output, which
false-positively matched any header containing an htmx header name as a
substring — e.g. X-HX-Trigger or HX-Trigger-User. After the false-positive,
xhr.getResponseHeader('HX-Trigger') returned null, and handleTriggerHeader
crashed on triggerBody.indexOf('{').

Refactors hasHeader(xhr, regex) → hasHeader(xhr, name), using
getResponseHeader(name) !== null as the check. This is the exact check
the 12 call sites need, eliminates the substring-match class of bug, and
removes a layer of indirection (no more regex construction or
getAllResponseHeaders() scan per check).

Adds a regression test with X-HX-Trigger: foo that previously crashed
inside handleTriggerHeader.

Fixes #527. Addresses @1cg's suggestion in that thread.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 11:49:58 -06:00
..
2024-01-18 10:20:34 -05:00
2025-04-24 13:54:43 -06:00
2025-04-24 13:54:43 -06:00
2023-12-21 13:22:10 -05:00