MCPcopy
hub / github.com/hapijs/hapi / _dispatch

Method _dispatch

lib/core.js:505–539  ·  view source on GitHub ↗
(options = {})

Source from the content-addressed store, hash-verified

503 }
504
505 _dispatch(options = {}) {
506
507 return (req, res) => {
508
509 // Create request
510
511 const request = Request.generate(this.root, req, res, options);
512
513 // Track socket request processing state
514
515 if (this.settings.operations.cleanStop &&
516 req.socket) {
517
518 this.actives.set(req.socket, request);
519 const env = { core: this, req };
520 res.on('finish', internals.onFinish.bind(res, env));
521 }
522
523 // Check load
524
525 if (this.settings.load.sampleInterval) {
526 try {
527 this.heavy.check();
528 }
529 catch (err) {
530 Bounce.rethrow(err, 'system');
531 this._log(['load'], this.heavy.load);
532 request._reply(err);
533 return;
534 }
535 }
536
537 request._execute();
538 };
539 }
540
541 _createListener() {
542

Callers 2

_createListenerMethod · 0.80
injectMethod · 0.80

Calls 6

generateMethod · 0.80
bindMethod · 0.80
_replyMethod · 0.80
_executeMethod · 0.80
onMethod · 0.65
_logMethod · 0.45

Tested by

no test coverage detected