(res: ServerResponse, statusCode: number, body: ApiResponse)
| 113 | } |
| 114 | |
| 115 | private sendJson(res: ServerResponse, statusCode: number, body: ApiResponse): void { |
| 116 | res.writeHead(statusCode, { |
| 117 | 'Content-Type': 'application/json; charset=utf-8', |
| 118 | 'Access-Control-Allow-Origin': '*', |
| 119 | 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', |
| 120 | 'Access-Control-Allow-Headers': 'Content-Type, Authorization' |
| 121 | }) |
| 122 | res.end(JSON.stringify(body)) |
| 123 | } |
| 124 | |
| 125 | private async handleRequest(req: IncomingMessage, res: ServerResponse): Promise<void> { |
| 126 | if (req.method === 'OPTIONS') { |
no test coverage detected