-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
The SSE parser in htmx 4 currently removes all leading whitespace from field values. According to the SSE spec, only one leading space may be removed, and only if it exists.
Relevant code:
Line 719 in 4403f8e
| let value = line.slice(colonIndex + 1).trimStart(); |
Spec reference:
https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation
Collect the characters on the line after the first U+003A COLON character (:), and let value be that string. If value starts with a U+0020 SPACE character, remove it from value.
Example
Given this SSE payload:
id: 45
event: message
data: Hello, World!
Current behavior:
id = "45"
event = "message"
data = "Hello, World!"
Expected behavior (per spec):
id = "45"
event = " message"
data = " Hello, World!"
Metadata
Metadata
Assignees
Labels
No labels