http: do not override user-provided options object

PR-URL: https://github.com/nodejs/node/pull/33633
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
KuthorX 2023-12-19 17:55:21 +08:00 committed by GitHub
parent 7a216d5fd6
commit c925039b35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 9 deletions

View file

@ -0,0 +1,14 @@
'use strict';
require('../common');
const assert = require('assert');
const ClientRequest = require('http').ClientRequest;
{
assert.throws(() => {
new ClientRequest({ insecureHTTPParser: 'wrongValue' });
}, {
code: 'ERR_INVALID_ARG_TYPE',
message: /insecureHTTPParser/
}, 'http request should throw when passing invalid insecureHTTPParser');
}