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();
|
||||
|
||||
try {
|
||||
this.onRequestCallback({ type: "invokeAction", target: op, extraData: { args: req.body, async: false } });
|
||||
return res.send(204).end();
|
||||
// This will probably need some rework in production code
|
||||
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 {
|
||||
return res.status(500).end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user