diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index 0cad5209c4ff4e..649f4843a846fa 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -75,6 +75,7 @@ const internalBindingWhitelist = new SafeSet([ 'fs', 'fs_event_wrap', 'http_parser', + 'http_parser_llhttp', 'icu', 'inspector', 'js_stream', diff --git a/test/parallel/test-http-parser-lazy-loaded.js b/test/parallel/test-http-parser-lazy-loaded.js index a6c19f9353ad50..5fc376951027ab 100644 --- a/test/parallel/test-http-parser-lazy-loaded.js +++ b/test/parallel/test-http-parser-lazy-loaded.js @@ -2,7 +2,6 @@ 'use strict'; const common = require('../common'); -const { internalBinding } = require('internal/test/binding'); const { getOptionValue } = require('internal/options'); // Monkey patch before requiring anything @@ -16,9 +15,12 @@ class DummyParser { } DummyParser.REQUEST = Symbol(); +// Note: using process.binding instead of internalBinding because this test is +// verifying that user applications are still able to monkey-patch the +// http_parser module. const binding = getOptionValue('--http-parser') === 'legacy' ? - internalBinding('http_parser') : internalBinding('http_parser_llhttp'); + process.binding('http_parser') : process.binding('http_parser_llhttp'); binding.HTTPParser = DummyParser; const assert = require('assert'); @@ -34,7 +36,9 @@ assert.strictEqual(parser.test_type, DummyParser.REQUEST); if (process.argv[2] !== 'child') { // Also test in a child process with IPC (specific case of https://github.com/nodejs/node/issues/23716) const child = spawn(process.execPath, [ - '--expose-internals', __filename, 'child' + '--expose-internals', + `--http-parser=${getOptionValue('--http-parser')}`, + __filename, 'child' ], { stdio: ['inherit', 'inherit', 'inherit', 'ipc'] });