(req)
| 724 | } |
| 725 | |
| 726 | async function readJson(req) { |
| 727 | const chunks = [] |
| 728 | for await (const chunk of req) { |
| 729 | chunks.push(chunk) |
| 730 | } |
| 731 | const text = Buffer.concat(chunks).toString('utf8') |
| 732 | return text ? JSON.parse(text) : {} |
| 733 | } |
| 734 | |
| 735 | function writeSse(res, event, data) { |
| 736 | res.write(`event: ${event}\n`) |
no test coverage detected