fetch-event-source icon indicating copy to clipboard operation
fetch-event-source copied to clipboard

Support `Headers` in init

Open ankon opened this issue 2 years ago • 1 comments
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.

ankon avatar Apr 04 '23 17:04 ankon

My workaround:

const headers = new Headers()

fetchEventSource('/api/sse', {
      headers: Object.fromEntries(headers),
})

piotr-cz avatar Dec 13 '23 14:12 piotr-cz