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

Method processRequest

packager/src/Server/index.js:610–718  ·  view source on GitHub ↗
(
    req: IncomingMessage,
    res: ServerResponse,
    next: () => mixed,
  )

Source from the content-addressed store, hash-verified

608 }
609
610 processRequest(
611 req: IncomingMessage,
612 res: ServerResponse,
613 next: () => mixed,
614 ) {
615 const urlObj = url.parse(req.url, true);
616 const {host} = req.headers;
617 debug(`Handling request: ${host ? 'http://' + host : ''}${req.url}`);
618 /* $FlowFixMe: Could be empty if the URL is invalid. */
619 const pathname: string = urlObj.pathname;
620
621 let requestType;
622 if (pathname.match(/\.bundle$/)) {
623 requestType = 'bundle';
624 } else if (pathname.match(/\.map$/)) {
625 requestType = 'map';
626 } else if (pathname.match(/\.assets$/)) {
627 requestType = 'assets';
628 } else if (pathname.match(/^\/debug/)) {
629 this._processDebugRequest(req.url, res);
630 return;
631 } else if (pathname.match(/^\/onchange\/?$/)) {
632 this._processOnChangeRequest(req, res);
633 return;
634 } else if (pathname.match(/^\/assets\//)) {
635 this._processAssetsRequest(req, res);
636 return;
637 } else if (pathname === '/symbolicate') {
638 this._symbolicate(req, res);
639 return;
640 } else {
641 next();
642 return;
643 }
644
645 const options = this._getOptionsFromUrl(req.url);
646 const requestingBundleLogEntry =
647 log(createActionStartEntry({
648 action_name: 'Requesting bundle',
649 bundle_url: req.url,
650 entry_point: options.entryFile,
651 }));
652
653 let reportProgress = () => {};
654 if (!this._opts.silent) {
655 reportProgress = (transformedFileCount, totalFileCount) => {
656 this._reporter.update({
657 type: 'bundle_transform_progressed',
658 entryFilePath: options.entryFile,
659 transformedFileCount,
660 totalFileCount,
661 });
662 };
663 }
664
665 const mres = MultipartResponse.wrap(req, res);
666 options.onProgress = (done, total) => {
667 reportProgress(done, total);

Callers 1

Server-test.jsFile · 0.45

Calls 15

_processDebugRequestMethod · 0.95
_processAssetsRequestMethod · 0.95
_symbolicateMethod · 0.95
_getOptionsFromUrlMethod · 0.95
_handleErrorMethod · 0.95
optionsHashMethod · 0.95
debugFunction · 0.85
createActionStartEntryFunction · 0.85
createActionEndEntryFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected