( res: ServerResponse, status: number, payload: unknown, )
| 32 | } |
| 33 | |
| 34 | export function writeJson( |
| 35 | res: ServerResponse, |
| 36 | status: number, |
| 37 | payload: unknown, |
| 38 | ): void { |
| 39 | const body = JSON.stringify(payload); |
| 40 | res.writeHead(status, { "content-type": "application/json; charset=utf-8" }); |
| 41 | res.end(body); |
| 42 | } |
| 43 | |
| 44 | export function writeText( |
| 45 | res: ServerResponse, |
no test coverage detected