MCPcopy
hub / github.com/ChromeDevTools/chrome-devtools-mcp / #handle

Method #handle

tests/server.ts:72–84  ·  view source on GitHub ↗
(req: IncomingMessage, res: ServerResponse)

Source from the content-addressed store, hash-verified

70 }
71
72 #handle(req: IncomingMessage, res: ServerResponse) {
73 const url = req.url ?? '';
74 const routeHandler = this.#routes[url];
75
76 if (routeHandler) {
77 routeHandler(req, res);
78 } else {
79 res.writeHead(404, {'Content-Type': 'text/html'});
80 res.end(
81 html`<h1>404 - Not Found</h1><p>The requested page does not exist.</p>`,
82 );
83 }
84 }
85
86 restore() {
87 this.#routes = {};

Callers 1

constructorMethod · 0.95

Calls 1

htmlFunction · 0.85

Tested by

no test coverage detected