Skip to content

Commit 9be0af3

Browse files
committed
[fix] Set "content-length" header to "0" if it is not already set on DELETE requests. Fixes #338.
1 parent a89e2f2 commit 9be0af3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ HttpProxy.prototype.proxyRequest = function (req, res, buffer) {
126126
reverseProxy,
127127
location;
128128

129+
// If this is a DELETE request then set the "content-length"
130+
// header (if it is not already set)
131+
if (req.method === 'DELETE') {
132+
req.headers['content-length'] = req.headers['content-length'] || '0';
133+
}
134+
129135
//
130136
// Add common proxy headers to the request so that they can
131137
// be availible to the proxy target server. If the proxy is

0 commit comments

Comments
 (0)