(req)
| 133 | } |
| 134 | |
| 135 | async function readJson(req) { |
| 136 | const chunks = [] |
| 137 | for await (const chunk of req) { |
| 138 | chunks.push(chunk) |
| 139 | } |
| 140 | const text = Buffer.concat(chunks).toString('utf8') |
| 141 | return text ? JSON.parse(text) : {} |
| 142 | } |
| 143 | |
| 144 | async function getFreePort() { |
| 145 | const server = http.createServer() |