Skip to content

Commit 9f4cd52

Browse files
committed
Don't pass a body if no body was received
request throws an error for HEAD requests with a body, even if the Buffer is empty
1 parent 05b07d1 commit 9f4cd52

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/proxy.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,9 @@ 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
};

0 commit comments

Comments
 (0)