MCPcopy
hub / github.com/browserless/browserless / handler

Method handler

src/shared/json-new.http.ts:47–67  ·  view source on GitHub ↗
(_req: Request, res: Response)

Source from the content-addressed store, hash-verified

45 tags = [APITags.browserAPI];
46
47 async handler(_req: Request, res: Response): Promise<void> {
48 const config = this.config();
49 const externalAddress = config.getExternalWebSocketAddress();
50 const id = pageID();
51 const { protocol, host, pathname, href } = new URL(
52 `/devtools/page/${id}`,
53 externalAddress,
54 );
55 const param = protocol.includes('wss') ? 'wss' : 'ws';
56 const value = path.join(host, pathname);
57
58 return jsonResponse(res, 200, {
59 description: '',
60 devtoolsFrontendUrl: `/devtools/inspector.html?${param}=${value}`,
61 id,
62 title: 'New Tab',
63 type: 'page',
64 url: 'about:blank',
65 webSocketDebuggerUrl: href,
66 });
67 }
68}

Callers

nothing calls this directly

Calls 3

pageIDFunction · 0.85
jsonResponseFunction · 0.85

Tested by

no test coverage detected