Skip to content

Commit a89e2f2

Browse files
committed
[fix] Do not use "Transfer-Encoding: chunked" header for proxied DELETE requests with no "Content-Length" header. Fixes #373.
1 parent 6a278b3 commit a89e2f2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/node-http-proxy/http-proxy.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,10 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
253253
}
254254

255255
// Remove `Transfer-Encoding` header if client's protocol is HTTP/1.0
256-
if (req.httpVersion === '1.0') {
256+
// or if this is a DELETE request with no content-length header.
257+
// See: https://github.com/nodejitsu/node-http-proxy/pull/373
258+
if (req.httpVersion === '1.0' || (req.method === 'DELETE'
259+
&& !req.headers['content-length'])) {
257260
delete response.headers['transfer-encoding'];
258261
}
259262

0 commit comments

Comments
 (0)