* Send JSON response.
(res: ServerResponse, status: number, data: unknown)
| 193 | * Send JSON response. |
| 194 | */ |
| 195 | function sendJson(res: ServerResponse, status: number, data: unknown): void { |
| 196 | res.writeHead(status, { |
| 197 | "Content-Type": "application/json", |
| 198 | "Access-Control-Allow-Origin": "*", |
| 199 | "Access-Control-Allow-Methods": "GET, POST, PATCH, DELETE, OPTIONS", |
| 200 | "Access-Control-Allow-Headers": "Content-Type", |
| 201 | }); |
| 202 | res.end(JSON.stringify(data)); |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * Send error response. |
no outgoing calls
no test coverage detected
searching dependent graphs…