(
response: http.ServerResponse,
status: number,
body: Readonly<Record<string, unknown>>,
headers: Readonly<Record<string, string>> = {},
)
| 36 | }> {} |
| 37 | |
| 38 | const writeJson = ( |
| 39 | response: http.ServerResponse, |
| 40 | status: number, |
| 41 | body: Readonly<Record<string, unknown>>, |
| 42 | headers: Readonly<Record<string, string>> = {}, |
| 43 | ) => { |
| 44 | response.writeHead(status, { |
| 45 | "content-type": "application/json", |
| 46 | ...headers, |
| 47 | }); |
| 48 | response.end(JSON.stringify(body)); |
| 49 | }; |
| 50 | |
| 51 | const writeText = (response: http.ServerResponse, status: number, body: string) => { |
| 52 | response.writeHead(status, { "content-type": "text/plain; charset=utf-8" }); |