(req, res)
| 84 | } |
| 85 | |
| 86 | function writeInvalidBackendUrlResponse(req, res) { |
| 87 | const message = "Invalid backend URL"; |
| 88 | console.error(`Proxy error for ${req.url}: ${message}`); |
| 89 | if (!res.headersSent) { |
| 90 | res.writeHead(502, { "Content-Type": "text/plain; charset=utf-8" }); |
| 91 | res.end(`Bad Gateway: ${message}`); |
| 92 | } else { |
| 93 | res.destroy(); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | export function isServerInfoRequest(req) { |
| 98 | const pathname = new URL(req.url ?? "/", "http://localhost").pathname; |
no test coverage detected