MCPcopy Create free account
hub / github.com/acode/cli / resolve

Method resolve

cli/local_gateway.js:60–78  ·  view source on GitHub ↗
(req, res, buffer, callback)

Source from the content-addressed store, hash-verified

58 }
59
60 resolve (req, res, buffer, callback) {
61 let urlinfo = url.parse(req.url, true);
62 let pathname = urlinfo.pathname;
63 if (this.serviceName && pathname.indexOf(this.serviceName) !== 1) {
64 let e = new Error(`Local Service Not Loaded: ${pathname}`);
65 e.statusCode = 404;
66 return callback(e);
67 } else {
68 pathname = pathname.substr(1 + this.serviceName.length);
69 }
70 let definition;
71 try {
72 definition = this.findDefinition(this.definitions, pathname);
73 } catch (e) {
74 e.statusCode = 404;
75 return callback(e);
76 }
77 return callback(null, definition, {}, buffer);
78 }
79
80 end (req, value) {
81 value = value === undefined ? null : value;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected