From 60d9b72286ac42a9ea29959876f741d2b364d094 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Sun, 5 Apr 2026 15:20:56 -0700 Subject: [PATCH] chore: use Object.hasOwn for iterator checks --- lib/core/util.js | 2 +- lib/interceptor/dns.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/util.js b/lib/core/util.js index 4f8feada8a1..0c72e5d598a 100644 --- a/lib/core/util.js +++ b/lib/core/util.js @@ -321,7 +321,7 @@ function isIterable (obj) { */ function hasSafeIterator (obj) { const prototype = Object.getPrototypeOf(obj) - const ownIterator = Object.prototype.hasOwnProperty.call(obj, Symbol.iterator) + const ownIterator = Object.hasOwn(obj, Symbol.iterator) return ownIterator || (prototype != null && prototype !== Object.prototype && typeof obj[Symbol.iterator] === 'function') } diff --git a/lib/interceptor/dns.js b/lib/interceptor/dns.js index 38cb2fcbef3..6347d1ffefc 100644 --- a/lib/interceptor/dns.js +++ b/lib/interceptor/dns.js @@ -7,7 +7,7 @@ const maxInt = Math.pow(2, 31) - 1 function hasSafeIterator (headers) { const prototype = Object.getPrototypeOf(headers) - const ownIterator = Object.prototype.hasOwnProperty.call(headers, Symbol.iterator) + const ownIterator = Object.hasOwn(headers, Symbol.iterator) return ownIterator || (prototype != null && prototype !== Object.prototype && typeof headers[Symbol.iterator] === 'function') }