(text: string)
| 438 | } |
| 439 | |
| 440 | function parseJsonOrText(text: string): unknown { |
| 441 | if (!text) return undefined |
| 442 | try { |
| 443 | return JSON.parse(text) |
| 444 | } catch { |
| 445 | return { message: text } |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | async function* parseServerSentEvents(response: Response) { |
| 450 | const body = response.body |