MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / addJavaScriptRoute

Function addJavaScriptRoute

tests/network_overrides.test.ts:21–32  ·  view source on GitHub ↗
(
    routePath: string,
    source: string,
    onRequest?: () => void,
  )

Source from the content-addressed store, hash-verified

19 const server = serverHooks();
20
21 function addJavaScriptRoute(
22 routePath: string,
23 source: string,
24 onRequest?: () => void,
25 ): void {
26 server.addRoute(routePath, (_req, res) => {
27 onRequest?.();
28 res.setHeader('Content-Type', 'application/javascript; charset=utf-8');
29 res.statusCode = 200;
30 res.end(source);
31 });
32 }
33
34 it('redirects matching requests across reloads until removed', async () => {
35 let originalRequests = 0;

Callers 1

Calls 1

addRouteMethod · 0.80

Tested by

no test coverage detected