diff --git a/lib/proxy.js b/lib/proxy.js index 4b6b3e2..2cce36b 100644 --- a/lib/proxy.js +++ b/lib/proxy.js @@ -234,11 +234,17 @@ function bypass(req, res, params) { req.on('end', function() { params.method = req.method; - params.body = raw; + if (raw.length > 0) { + params.body = raw; + } params.headers = { 'Content-Type': req.headers['content-type'] }; - return request(params).pipe(res); + return request(params) + .on('error', function (err) { + log.error('bypass', err); + }) + .pipe(res); }); }