Skip to content

Commit

Permalink
http: set rejectNonStandardBodyWrites option default to false
Browse files Browse the repository at this point in the history
  • Loading branch information
gerrard00 committed May 2, 2023
1 parent dd8ff7b commit 3f1f15d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ function storeHTTPOptions(options) {
validateBoolean(rejectNonStandardBodyWrites, 'options.rejectNonStandardBodyWrites');
this.rejectNonStandardBodyWrites = rejectNonStandardBodyWrites;
} else {
this.rejectNonStandardBodyWrites = true
this.rejectNonStandardBodyWrites = false
}
}

Expand Down
11 changes: 2 additions & 9 deletions test/parallel/test-http-head-throw-on-response-body-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 3f1f15d

Please sign in to comment.