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: #25783

PR-URL: #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 targos committed May 20, 2019
1 parent 83f2430 commit bfb9356
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 bfb9356

Please sign in to comment.