From cb6345f5c7f605222bacfd5f30eff81891df6530 Mon Sep 17 00:00:00 2001 From: Mikhail Chechnev Date: Sat, 29 Dec 2018 20:07:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D1=81=D1=82=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D1=8F=D0=B5=D0=BC=20=D1=82=D0=B5=D0=BB=D0=BE=20=D1=81=D0=BE?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81=20=D1=83?= =?UTF-8?q?=D1=87=D1=91=D1=82=D0=BE=D0=BC=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B?= =?UTF-8?q?=D1=85,=20=D0=BF=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=87=D0=B8=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=20(=D0=B4=D0=BB=D1=8F=20POST=20-=20=D0=B2=20=D1=82?= =?UTF-8?q?=D0=B5=D0=BB=D0=BE,=20=D0=B4=D0=BB=D1=8F=20GET=20-=20=D0=B2=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D1=80=D0=BE=D1=81=20URL)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/out_queue_processor.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/core/out_queue_processor.js b/core/out_queue_processor.js index 99943e7..ef1f9c3 100644 --- a/core/out_queue_processor.js +++ b/core/out_queue_processor.js @@ -146,6 +146,15 @@ const appProcess = async prms => { nQueueId: prms.queue.nId, blMsg: prms.queue.blMsg }); + if (prms.service.sFnPrmsType == objServiceFnSchema.NFN_PRMS_TYPE_POST) { + options.body = prms.queue.blMsg; + } else { + options.url = buildURL({ + sSrvRoot: prms.service.sSrvRoot, + sFnURL: prms.function.sFnURL, + sQuery: prms.queue.blMsg.toString() + }); + } } if (!_.isUndefined(resBefore.context)) prms.service.context = _.cloneDeep(resBefore.context); } else { @@ -156,7 +165,12 @@ const appProcess = async prms => { } //Отправляем сообщение удалённому серверу let serverResp = await rqp(options); + //Сохраняем полученный ответ _.extend(prms, { serverResp }); + await dbConn.setQueueResp({ + nQueueId: prms.queue.nId, + blResp: new Buffer(prms.serverResp) + }); //Выполняем обработчик "После" (если он есть) if (prms.function.sAppSrvAfter) { const fnAfter = getAppSrvFunction(prms.function.sAppSrvAfter); @@ -167,7 +181,7 @@ const appProcess = async prms => { } catch (e) { throw new ServerError(SERR_APP_SERVER_AFTER, e.message); } - //Проверяем структуру ответа функции предобработки + //Проверяем структуру ответа функции постобработки if (resAfter) { let sCheckResult = validateObject( resAfter,