(res: import('http').ServerResponse, status: number, body: unknown)
| 150 | } |
| 151 | |
| 152 | function respond(res: import('http').ServerResponse, status: number, body: unknown): void { |
| 153 | const payload = JSON.stringify(body); |
| 154 | res.writeHead(status, { 'content-type': 'application/json', 'content-length': Buffer.byteLength(payload) }); |
| 155 | res.end(payload); |
| 156 | } |
| 157 | |
| 158 | async function fetchJson(method: string, url: string, init: { headers?: Record<string, string>; body?: string } = {}): Promise<{ status: number; body: unknown }> { |
| 159 | const res = await fetch(url, { method, headers: init.headers, body: init.body }); |
no test coverage detected