Skip to content

Handle message newlines in event data #36

@jfallows

Description

@jfallows

When message payload contains \r, \n or \r\n then by SSE spec they are canonicalized to \n.

message

1\n
2\r
3\r\n
4

event

data: 1\n
data: 2\n
data: 3\n
data: 4\n
\n

Therefore, we must inject \ndata: to replace \r, \n or \r\n in the message payload, and the event still starts with data: and ends with \n\n as usual.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions