MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / _processDebugRequest

Method _processDebugRequest

packager/src/Server/index.js:367–395  ·  view source on GitHub ↗
(reqUrl: string, res: ServerResponse)

Source from the content-addressed store, hash-verified

365 }
366
367 _processDebugRequest(reqUrl: string, res: ServerResponse) {
368 let ret = '<!doctype html>';
369 const pathname = url.parse(reqUrl).pathname;
370 /* $FlowFixMe: pathname would be null for an invalid URL */
371 const parts = pathname.split('/').filter(Boolean);
372 if (parts.length === 1) {
373 ret += '<div><a href="/debug/bundles">Cached Bundles</a></div>';
374 res.end(ret);
375 } else if (parts[1] === 'bundles') {
376 ret += '<h1> Cached Bundles </h1>';
377 Promise.all(Object.keys(this._bundles).map(optionsJson =>
378 this._bundles[optionsJson].then(p => {
379 ret += '<div><h2>' + optionsJson + '</h2>';
380 ret += p.getDebugInfo();
381 })
382 )).then(
383 () => res.end(ret),
384 e => {
385 res.writeHead(500);
386 res.end('Internal Error');
387 terminal.log(e.stack); // eslint-disable-line no-console-disallow
388 }
389 );
390 } else {
391 res.writeHead(404);
392 res.end('Invalid debug request');
393 return;
394 }
395 }
396
397 _processOnChangeRequest(req: IncomingMessage, res: ServerResponse) {
398 const watchers = this._changeWatchers;

Callers 1

processRequestMethod · 0.95

Calls 7

parseMethod · 0.80
getDebugInfoMethod · 0.80
writeHeadMethod · 0.80
logMethod · 0.65
filterMethod · 0.45
endMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected