(req, res)
| 51 | } |
| 52 | |
| 53 | function writeInvalidBackendUrlResponse(req, res) { |
| 54 | const message = "Invalid backend URL"; |
| 55 | console.error(`Proxy error for ${req.url}: ${message}`); |
| 56 | if (!res.headersSent) { |
| 57 | res.writeHead(502, { "Content-Type": "text/plain; charset=utf-8" }); |
| 58 | res.end(`Bad Gateway: ${message}`); |
| 59 | } else { |
| 60 | res.destroy(); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | export function isServerInfoRequest(req) { |
| 65 | const pathname = new URL(req.url ?? "/", "http://localhost").pathname; |
no test coverage detected