diff --git a/lib/_http_server.js b/lib/_http_server.js index b2cce201009c52..d55ee98ec2d4a8 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -490,7 +490,7 @@ function storeHTTPOptions(options) { validateBoolean(rejectNonStandardBodyWrites, 'options.rejectNonStandardBodyWrites'); this.rejectNonStandardBodyWrites = rejectNonStandardBodyWrites; } else { - this.rejectNonStandardBodyWrites = true + this.rejectNonStandardBodyWrites = false } } diff --git a/test/parallel/test-http-head-throw-on-response-body-write.js b/test/parallel/test-http-head-throw-on-response-body-write.js index 6c3c3cf9f52e50..7352b20d84df6e 100644 --- a/test/parallel/test-http-head-throw-on-response-body-write.js +++ b/test/parallel/test-http-head-throw-on-response-body-write.js @@ -24,17 +24,10 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); -// should be using common.mustCall on both req res callbacks provided to createServer { const server = http.createServer((req, res) => { - assert.throws(() => { - res.write('this is content'); - }, { - code: 'ERR_HTTP_BODY_NOT_ALLOWED', - name: 'Error', - message: 'Adding content for this request method or response status is not allowed.' - }); - res.end(); + res.writeHead(200); + res.end('this is content'); }); server.listen(0);