Skip to content

Commit

Permalink
marklogic-community#31: improved piping and ending req
Browse files Browse the repository at this point in the history
  • Loading branch information
grtjn committed Mar 1, 2016
1 parent 90c8775 commit 86bebfe
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/templates/node-server/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,15 @@ function proxy(req, res) {
});
});

if (req.body !== undefined) {
mlReq.write(JSON.stringify(req.body));
req.pipe(mlReq);
req.on('end', function() {
mlReq.end();
}
});

mlReq.on('error', function(e) {
console.log('Problem with request: ' + e.message);
res.statusCode = 500;
res.end();
});
}

Expand Down

0 comments on commit 86bebfe

Please sign in to comment.