eventsource
eventsource copied to clipboard
Casing of Last-Event-ID header must be exact or duplicate events can be received after reconnect
I am observing the following behavior with the current npm version of this library (1.1.0).
If the following sequence of events occurs:
EventSourceis constructed with an explicit header value forLast-Event-IDbut with different casing.- At least one event with an ID is received.
On the next successful reconnection, this library will send the initially-provided Last-Event-ID value instead of the most recent event ID. This can cause a gigantic amount of history to be replayed on the server and duplicate messages received, depending on how many messages were received since the instance was constructed.
As HTTP headers are case-insensitive, it seems wrong that the casing of the Last-Event-ID header provided to the constructor should in any way affect the observable behavior of this library.