(
response: http.ServerResponse,
status: number,
body: Readonly<Record<string, unknown>>,
headers: Readonly<Record<string, string>> = {},
)
| 52 | }> {} |
| 53 | |
| 54 | const writeJson = ( |
| 55 | response: http.ServerResponse, |
| 56 | status: number, |
| 57 | body: Readonly<Record<string, unknown>>, |
| 58 | headers: Readonly<Record<string, string>> = {}, |
| 59 | ) => { |
| 60 | response.writeHead(status, { |
| 61 | "content-type": "application/json", |
| 62 | ...headers, |
| 63 | }); |
| 64 | response.end(JSON.stringify(body)); |
| 65 | }; |
| 66 | |
| 67 | const writeText = (response: http.ServerResponse, status: number, body: string) => { |
| 68 | response.writeHead(status, { "content-type": "text/plain; charset=utf-8" }); |
no test coverage detected