diff --git a/lib/_http_agent.js b/lib/_http_agent.js
index 6f6a0920fd8c04..686d561b283d89 100644
--- a/lib/_http_agent.js
+++ b/lib/_http_agent.js
@@ -435,7 +435,7 @@ Agent.prototype.removeSocket = function removeSocket(s, options) {
     // There might be older requests in a different origin, but
     // if the origin which releases the socket has pending requests
     // that will be prioritized.
-    for (const prop in this.requests) {
+    for (const prop of ObjectKeys(this.requests)) {
       // Check whether this specific origin is already at maxSockets
       if (this.sockets[prop] && this.sockets[prop].length) break;
       debug('removeSocket, have a request with different origin,' +