Last stuff for the if server
This commit is contained in:
@@ -218,8 +218,14 @@ export default class HTTPInterfaceServer extends AbstractInterfaceServer<Config>
|
|||||||
if (op === null || !AASCoreTypes.isOperation(op)) return res.status(404).end();
|
if (op === null || !AASCoreTypes.isOperation(op)) return res.status(404).end();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.onRequestCallback({ type: "invokeAction", target: op, extraData: { args: req.body, async: false } });
|
// This will probably need some rework in production code
|
||||||
return res.send(204).end();
|
const result = this.onRequestCallback({ type: "invokeAction", target: op, extraData: { args: req.body, async: false } });
|
||||||
|
if (result) {
|
||||||
|
if (req.accepts("json")) res.setHeader("content-type", "application/json");
|
||||||
|
return res.status(200).send(result).end();
|
||||||
|
} else {
|
||||||
|
return res.status(204).end();
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
return res.status(500).end();
|
return res.status(500).end();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user