@modular-rest/server 1.14.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,9 +59,10 @@ functionRouter.post('/run', middleware.auth, async (ctx) => {
59
59
  const { name, args } = ctx.request.body;
60
60
  try {
61
61
  const result = await service.runFunction(name, args, ctx.state.user);
62
- ctx.body = JSON.stringify((0, reply_1.create)('s', { data: result }));
62
+ ctx.body = (0, reply_1.create)('s', { data: result });
63
63
  }
64
64
  catch (e) {
65
- ctx.throw(400, JSON.stringify((0, reply_1.create)('e', { error: e.message })));
65
+ ctx.status = 400;
66
+ ctx.body = (0, reply_1.create)('e', { message: e.message });
66
67
  }
67
68
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-rest/server",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "description": "TypeScript version of a nodejs module based on KOAJS for developing Rest-APIs in a modular solution.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,9 +25,10 @@ functionRouter.post('/run', middleware.auth, async (ctx: Context) => {
25
25
 
26
26
  try {
27
27
  const result = await service.runFunction(name, args, ctx.state.user);
28
- ctx.body = JSON.stringify(reply('s', { data: result }));
28
+ ctx.body = reply('s', { data: result });
29
29
  } catch (e) {
30
- ctx.throw(400, JSON.stringify(reply('e', { error: (e as Error).message })));
30
+ ctx.status = 400;
31
+ ctx.body = reply('e', { message: (e as Error).message });
31
32
  }
32
33
  });
33
34