Commit 69c60b98 authored by Kamron Aroonrua's avatar Kamron Aroonrua 💬

response

parent 7d67f820
...@@ -70,7 +70,6 @@ HTTPListener.prototype._http_start = function() ...@@ -70,7 +70,6 @@ HTTPListener.prototype._http_start = function()
app.use(context.middleware({ app.use(context.middleware({
'httpacl' : self.httpacl, 'httpacl' : self.httpacl,
'jobcaller' : self.jobcaller, 'jobcaller' : self.jobcaller,
'msgrecv' : self.msgrecv,
'httpcb' : self.httpcb 'httpcb' : self.httpcb
})); }));
......
...@@ -21,7 +21,6 @@ var process_req = function(req, res ,method) { ...@@ -21,7 +21,6 @@ var process_req = function(req, res ,method) {
var httpacl = req.context.httpacl; var httpacl = req.context.httpacl;
//var evp = req.context.evp; //var evp = req.context.evp;
var jobcaller = req.context.jobcaller; var jobcaller = req.context.jobcaller;
var msgrecv = req.context.msgrecv;
var httpcb = req.context.httpcb; var httpcb = req.context.httpcb;
var j = httpacl.findJob(appkey,method); var j = httpacl.findJob(appkey,method);
...@@ -69,7 +68,7 @@ var process_req = function(req, res ,method) { ...@@ -69,7 +68,7 @@ var process_req = function(req, res ,method) {
if(iopt.session){ resp_msg.session=session_id } if(iopt.session){ resp_msg.session=session_id }
if(Number(iopt.timeout)>0){cb_timeout=Number(iopt.timeout)} if(Number(iopt.timeout)>0){cb_timeout=Number(iopt.timeout)}
if(iopt.response){ if(iopt.response){
cb_response=true cb_response=iopt.response
resp_msg.session=session_id resp_msg.session=session_id
} }
req.setTimeout(cb_timeout); req.setTimeout(cb_timeout);
...@@ -86,6 +85,10 @@ var process_req = function(req, res ,method) { ...@@ -86,6 +85,10 @@ var process_req = function(req, res ,method) {
if(cb_response){ if(cb_response){
httpcb.on(session_id,function(msg){ httpcb.on(session_id,function(msg){
resp_msg.response=msg.data.data; resp_msg.response=msg.data.data;
if(['data','data_only','json'].includes(String(cb_response).toLocaleLowerCase())){
resp_msg(resp_msg)
}
respHelper.responseOK(resp_msg); respHelper.responseOK(resp_msg);
}) })
}else{ }else{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment