Skip to content
Myr

fix(sse): close sse stream on end (#2529)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* close sse stream on end Adds a finally block to the SSEStream class. Otherwise streamSSE will error whenever used in Cloudflare Workers. * denoify * add a test ---------

authored by Dom Eccleston · committed by GitHub · parent c83d80f · Browse files · 3 files+10 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Yusuke Wada <yusuke@kamawada.com>

Diff stats

3 files+10 added−1 removed

  • tests:+6 added−1 removed
  • other:+4 added−0 removed

3 files+10 added−1 removed

modified:deno_dist/helper/streaming/sse.ts+2 added
modified:src/helper/streaming/sse.test.ts+6 added-1 removed
modified:src/helper/streaming/sse.ts+2 added
51 unmodified lines
52 })53 } else {54 console.error(e)55 }56 } finally {57 stream.close()58 }59}6061export const streamSSE = (
16 unmodified lines