fetch-event-source
fetch-event-source copied to clipboard
Support `Headers` in init
trafficstars
Basically this comment says it:
https://github.com/Azure/fetch-event-source/blob/a0529492576e094374602f24d5e64b3a271b4576/src/fetch.ts#L10
It would be nice to support Headers as well here, as failing requests because of this problem can be quite hard to debug.
My workaround:
const headers = new Headers()
fetchEventSource('/api/sse', {
headers: Object.fromEntries(headers),
})