Skip to content
Myr

fix(sse): emit retry feild when retry is `0` (#5135)

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

authored by Yusuke Wada · committed by GitHub · parent d796450 · Browse files · 2 files+26 added−3 removed
This commit

State

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

Diff stats

2 files+26 added−3 removed

  • tests:+22 added−0 removed
  • other:+4 added−3 removed

2 files+26 added−3 removed

modified:src/helper/streaming/sse.test.tsx+22 added
130 unmodified lines
131 const expectedRetryValue = `retry: ${retryTime}\n\n`132 expect(decodedValue).toContain(expectedRetryValue)133 })134135 it('Should accept retry: 0 and not skip it', async () => {136 const res = streamSSE(c, async (stream) => {137 await stream.writeSSE({138 data: 'This is a test message',139 retry: 0,140 })141 })142143 expect(res).not.toBeNull()144 expect(res.status).toBe(200)145146 if (!res.body) {147 throw new Error('Body is null')148 }149 const reader = res.body.getReader()150 const decoder = new TextDecoder()151 const { value } = await reader.read()152 const decodedValue = decoder.decode(value)153154 expect(decodedValue).toContain('retry: 0\n\n')155 })156157 it('Check stream Response if error occurred', async () => {158 const onError = vi.fn()159 const res = streamSSE(160 c,
260 unmodified lines
modified:src/helper/streaming/sse.ts+4 added-3 removed