Pipe the request directly

master
Jacob Windle 2019-01-26 11:18:31 -05:00
parent 8612ee9ee4
commit 2f102b06c3
1 changed files with 9 additions and 1 deletions

View File

@ -26,8 +26,17 @@ function startServer() {
body.push(chunk);
}).on("end", () => {
body = Buffer.concat(body).toString();
console.log(req.path);
logger.info({message: "Got a message!"});
logger.info({message: req});
let connector = http.request(
req.headers["Host"], {
headers: req.headers,
}, (resp) => {
resp.pipe(res);
});
req.pipe(connector);
})
})
@ -40,4 +49,3 @@ function startServer() {
}
startServer();
module.exports = [parseHttpRequest];