Commit 1e93f2e3a6d04d997e50bc483057db3e8a99bd46
1 parent
d6448432
Exists in
master
and in
1 other branch
Supporting callback argument
Showing
1 changed file
with
20 additions
and
1 deletions
Show diff stats
server.js
| @@ -317,7 +317,26 @@ app.post('/api', function(req, res){ | @@ -317,7 +317,26 @@ app.post('/api', function(req, res){ | ||
| 317 | 317 | ||
| 318 | /* Listener que dispara quando a requisição ao core da erro */ | 318 | /* Listener que dispara quando a requisição ao core da erro */ |
| 319 | child.on('error', function(code, signal){ | 319 | child.on('error', function(code, signal){ |
| 320 | - res.send(500, parameters.errorMessage('Erro na chamada ao core')); | 320 | + |
| 321 | + var data = querystring.stringify(parameters.errorMessage('Erro na chamada ao core')); | ||
| 322 | + | ||
| 323 | + var options = { | ||
| 324 | + host: path.hostname, | ||
| 325 | + port: path.port, | ||
| 326 | + path: path.path, | ||
| 327 | + method: 'POST', | ||
| 328 | + headers: { | ||
| 329 | + 'Content-Type': 'application/x-www-form-urlencoded', | ||
| 330 | + 'Content-Length': Buffer.byteLength(data) | ||
| 331 | + } | ||
| 332 | + }; | ||
| 333 | + | ||
| 334 | + var requesting = http.request(options, function(res) { | ||
| 335 | + res.setEncoding('utf8'); | ||
| 336 | + }); | ||
| 337 | + | ||
| 338 | + requesting.write(data); | ||
| 339 | + requesting.end(); | ||
| 321 | }); | 340 | }); |
| 322 | }); | 341 | }); |
| 323 | } else { | 342 | } else { |