Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const internalBindingWhitelist = new SafeSet([
'fs',
'fs_event_wrap',
'http_parser',
'http_parser_llhttp',
'icu',
'inspector',
'js_stream',
Expand Down
10 changes: 7 additions & 3 deletions test/parallel/test-http-parser-lazy-loaded.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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');
Expand All @@ -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']
});
Expand Down