Skip to content

Commit

Permalink
http: do not default to chunked encoding for TRACE
Browse files Browse the repository at this point in the history
Fixes: nodejs#25783

PR-URL: nodejs#27673
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
lpinca authored and addaleax committed May 19, 2019
1 parent 6f7e8b4 commit 4fc0238
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ function ClientRequest(input, options, cb) {
method === 'HEAD' ||
method === 'DELETE' ||
method === 'OPTIONS' ||
method === 'TRACE' ||
method === 'CONNECT') {
this.useChunkedEncodingByDefault = false;
} else {
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-http-client-default-headers-exist.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ const expectedHeaders = {
'HEAD': ['host', 'connection'],
'OPTIONS': ['host', 'connection'],
'POST': ['host', 'connection', 'content-length'],
'PUT': ['host', 'connection', 'content-length']
'PUT': ['host', 'connection', 'content-length'],
'TRACE': ['host', 'connection']
};

const expectedMethods = Object.keys(expectedHeaders);
Expand Down

0 comments on commit 4fc0238

Please sign in to comment.