when I request a response from other server via my node server, I do this:
app.use(function (req, res) {
req.pipe(request(url)).pipe(res).
})
But I use request-debug, find that no req.body to the other server, causing much trouble.
Can you tell me how to result it.
Thanks.
app.use(function (req, res) {
request(url).pipe(res).
})
try this
cheers!!
Thank you, I found the solution:
express default use 'app.use(body-parser('json'))', which means server get req and parser req.body to json. But pipe need stream to do. so change it to 'app.use(body-parser(raw()))'. raw() parser req.body to stream.
It's my solution.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Thank you, I found the solution:
express default use 'app.use(body-parser('json'))', which means server get req and parser req.body to json. But pipe need stream to do. so change it to 'app.use(body-parser(raw()))'. raw() parser req.body to stream.
It's my solution.