add authed method
This commit is contained in:
parent
d2bc7d5dd4
commit
f01ecdf5a8
@ -74,13 +74,22 @@ class API {
|
|||||||
} = request;
|
} = request;
|
||||||
if (!method)
|
if (!method)
|
||||||
return cb({
|
return cb({
|
||||||
error: "method missed"
|
error: "method missed",
|
||||||
|
ended: true
|
||||||
});
|
});
|
||||||
if (!trace_id)
|
if (!trace_id)
|
||||||
return cb({
|
return cb({
|
||||||
error: "trace_id missed"
|
error: "trace_id missed",
|
||||||
|
ended: true
|
||||||
});
|
});
|
||||||
return this.methods[method]?.(connection, request, cb);
|
const selmethod = this.methods[method];
|
||||||
|
if (selmethod === undefined)
|
||||||
|
return cb({
|
||||||
|
error: "unknown method: " + method,
|
||||||
|
trace_id,
|
||||||
|
ended: true
|
||||||
|
});
|
||||||
|
return selmethod(connection, request, cb);
|
||||||
} else {
|
} else {
|
||||||
return cb({
|
return cb({
|
||||||
error: "required JSON-object based request"
|
error: "required JSON-object based request"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module.exports = function (con, req, cb) {
|
module.exports = function (con, req, cb) {
|
||||||
return cb({ error: "At develop" });
|
return cb({ error: "At develop", trace_id: req.trace_id, ended: true });
|
||||||
//;
|
//;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user