Spec deviations with regards to trailing whitespace and field names without colons
Closed this issue · 0 comments
valadaptive commented
I've noticed two ways in which this library's parsing behavior deviates from the official event stream specification:
- Trailing whitespace is trimmed from each data block. While the last trailing newline should indeed be trimmed, the spec doesn't say to remove any other whitespace, and testing with Firefox's native
EventSource
confirms that trailing whitespace should be preserved. - Lines which don't contain a colon (field separator) are ignored. The spec says to treat the entire line as the name of the field in that case, meaning that a line containing only
data\n
should result in a newline being added to the data buffer (confirmed via in-browserEventSource
behavior).
EDIT: I've also fixed a third spec deviation:
- A blank "event" field should set the event type to an empty string, which should result in the actual dispatched event being of type "message".