enisdenjo / graphql-sse

Zero-dependency, HTTP/1 safe, simple, GraphQL over Server-Sent Events Protocol server and client.
https://the-guild.dev/graphql/sse
MIT License
384 stars 19 forks source link

Empty string in message.event field causes a runtime error. #47

Closed extremegf closed 1 year ago

extremegf commented 1 year ago

From RFC8895

The protocol defines three field names: event, id, and data. If a message has more than one "data" line, the value of the data field is the concatenation of the values on those lines. There can be only one "event" and "id" line per message. The "data" field is required; the others are optional.

The check below however fails when message.event === ""

https://github.com/enisdenjo/graphql-sse/blob/b4019e45ad18e6b0b36bd9e5798909d9bb2599ec/src/parser.ts#L88