From 1e93f2e3a6d04d997e50bc483057db3e8a99bd46 Mon Sep 17 00:00:00 2001 From: dhuy Date: Fri, 23 May 2014 13:32:53 -0300 Subject: [PATCH] Supporting callback argument --- server.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 87e4bb7..695240c 100644 --- a/server.js +++ b/server.js @@ -317,7 +317,26 @@ app.post('/api', function(req, res){ /* Listener que dispara quando a requisição ao core da erro */ child.on('error', function(code, signal){ - res.send(500, parameters.errorMessage('Erro na chamada ao core')); + + var data = querystring.stringify(parameters.errorMessage('Erro na chamada ao core')); + + var options = { + host: path.hostname, + port: path.port, + path: path.path, + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Length': Buffer.byteLength(data) + } + }; + + var requesting = http.request(options, function(res) { + res.setEncoding('utf8'); + }); + + requesting.write(data); + requesting.end(); }); }); } else { -- libgit2 0.21.2