Skip to content

Commit

Permalink
use process.binding if common does not have the HTTPParser
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Feb 24, 2021
1 parent d16a9e7 commit 6aba647
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/node/http-parser.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
'use strict'

// TODO: This is not really allowed by Node but it works for now.
const { HTTPParser } = require('_http_common')
const common = require('_http_common')

module.exports = HTTPParser
if (common.HTTPParser) {
module.exports = common.HTTPParser
} else {
// Node 10
module.exports = process.binding('http_parser').HTTPParser // eslint-disable-line
}

0 comments on commit 6aba647

Please sign in to comment.