(
response: ServerResponse,
statusCode: number,
body: string,
headers: Record<string, string> = {},
)
| 87 | } |
| 88 | |
| 89 | function send( |
| 90 | response: ServerResponse, |
| 91 | statusCode: number, |
| 92 | body: string, |
| 93 | headers: Record<string, string> = {}, |
| 94 | ): void { |
| 95 | response.writeHead(statusCode, { |
| 96 | "content-length": Buffer.byteLength(body).toString(), |
| 97 | ...headers, |
| 98 | }); |
| 99 | response.end(body); |
| 100 | } |
| 101 | |
| 102 | function requestPath(request: IncomingMessage): string { |
| 103 | const url = new URL(request.url ?? "/", "http://localhost"); |
no test coverage detected