Pipe the request directly

This commit is contained in:
Jacob Windle 2019-01-26 11:18:31 -05:00
parent 8612ee9ee4
commit 2f102b06c3

View File

@ -26,8 +26,17 @@ function startServer() {
body.push(chunk); body.push(chunk);
}).on("end", () => { }).on("end", () => {
body = Buffer.concat(body).toString(); body = Buffer.concat(body).toString();
console.log(req.path);
logger.info({message: "Got a message!"}); logger.info({message: "Got a message!"});
logger.info({message: req}); 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(); startServer();
module.exports = [parseHttpRequest];