From c20fd14c05192fccb8867d4fce25beca0e99ac32 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 5 Oct 2018 11:01:53 +0530 Subject: [PATCH] Handle empty response in frappe.call --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index edbaa336..e2b506f3 100644 --- a/index.js +++ b/index.js @@ -56,8 +56,11 @@ module.exports = { if (this.app) { // add to router if client-server this.app.post(`/api/method/${method}`, this.asyncHandler(async function(request, response) { - const data = await handler(request.body); - response.json(data); + let data = await handler(request.body); + if (data === undefined) { + data = {} + } + return response.json(data); })); } },