Skip to content

Commit 3f1f15d

Browse files
committed
http: set rejectNonStandardBodyWrites option default to false
1 parent dd8ff7b commit 3f1f15d

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

lib/_http_server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ function storeHTTPOptions(options) {
490490
validateBoolean(rejectNonStandardBodyWrites, 'options.rejectNonStandardBodyWrites');
491491
this.rejectNonStandardBodyWrites = rejectNonStandardBodyWrites;
492492
} else {
493-
this.rejectNonStandardBodyWrites = true
493+
this.rejectNonStandardBodyWrites = false
494494
}
495495
}
496496

test/parallel/test-http-head-throw-on-response-body-write.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,10 @@ const common = require('../common');
2424
const assert = require('assert');
2525
const http = require('http');
2626

27-
// should be using common.mustCall on both req res callbacks provided to createServer
2827
{
2928
const server = http.createServer((req, res) => {
30-
assert.throws(() => {
31-
res.write('this is content');
32-
}, {
33-
code: 'ERR_HTTP_BODY_NOT_ALLOWED',
34-
name: 'Error',
35-
message: 'Adding content for this request method or response status is not allowed.'
36-
});
37-
res.end();
29+
res.writeHead(200);
30+
res.end('this is content');
3831
});
3932
server.listen(0);
4033

0 commit comments

Comments
 (0)