Respect disablePrototypePoisoningProtection option (#2380)

This commit is contained in:
Josh Mock
2024-10-16 14:19:44 -05:00
committed by GitHub
parent 661caf8422
commit 82acfc33a9
4 changed files with 83 additions and 3 deletions

View File

@ -228,7 +228,21 @@ export default class Client extends API {
this.diagnostic = opts[kChild].diagnostic
} else {
this.diagnostic = new Diagnostic()
this.serializer = new options.Serializer()
let serializerOptions
if (opts.disablePrototypePoisoningProtection != null) {
if (typeof opts.disablePrototypePoisoningProtection === 'boolean') {
serializerOptions = {
enablePrototypePoisoningProtection: !opts.disablePrototypePoisoningProtection
}
} else {
serializerOptions = {
enablePrototypePoisoningProtection: opts.disablePrototypePoisoningProtection
}
}
}
this.serializer = new options.Serializer(serializerOptions)
this.connectionPool = new options.ConnectionPool({
pingTimeout: options.pingTimeout,
resurrectStrategy: options.resurrectStrategy,