Skip to content

Commit 882860f

Browse files
authored
Merge pull request #52 from felixfbecker/fix-crash
Fix crash on HEAD request
2 parents 05b07d1 + d8a60a5 commit 882860f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/proxy.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,17 @@ function bypass(req, res, params) {
234234

235235
req.on('end', function() {
236236
params.method = req.method;
237-
params.body = raw;
237+
if (raw.length > 0) {
238+
params.body = raw;
239+
}
238240
params.headers = {
239241
'Content-Type': req.headers['content-type']
240242
};
241-
return request(params).pipe(res);
243+
return request(params)
244+
.on('error', function (err) {
245+
log.error('bypass', err);
246+
})
247+
.pipe(res);
242248
});
243249
}
244250

0 commit comments

Comments
 (0)