diff --git a/lib/_http_client.js b/lib/_http_client.js index 75c86acf2c510c..bc2c2af8acd609 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -180,6 +180,7 @@ function ClientRequest(input, options, cb) { method === 'HEAD' || method === 'DELETE' || method === 'OPTIONS' || + method === 'TRACE' || method === 'CONNECT') { this.useChunkedEncodingByDefault = false; } else { diff --git a/test/parallel/test-http-client-default-headers-exist.js b/test/parallel/test-http-client-default-headers-exist.js index e0cf82e46220c4..ba4d4fa660b2cc 100644 --- a/test/parallel/test-http-client-default-headers-exist.js +++ b/test/parallel/test-http-client-default-headers-exist.js @@ -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);