summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2020-12-06 14:52:08 +0100
committerMichaël Zasso <targos@protonmail.com>2020-12-13 22:16:18 +0100
commit2ef9a76ece1e403d1dd7019fceb8f258607e7a69 (patch)
tree48f8fb044729f5fa4cb535aa4182d5c059a55654 /test
parentc6c83374028c44d280dd7eaa767348eaee3b9502 (diff)
downloadios-node-v8-2ef9a76ece1e403d1dd7019fceb8f258607e7a69.tar.gz
ios-node-v8-2ef9a76ece1e403d1dd7019fceb8f258607e7a69.tar.bz2
ios-node-v8-2ef9a76ece1e403d1dd7019fceb8f258607e7a69.zip
http: use objects with null prototype in Agent
Fixes: https://github.com/nodejs/node/issues/36364 PR-URL: https://github.com/nodejs/node/pull/36409 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-http-client-agent.js4
-rw-r--r--test/parallel/test-http-client-override-global-agent.js2
-rw-r--r--test/parallel/test-http-connect-req-res.js4
-rw-r--r--test/parallel/test-http-connect.js4
-rw-r--r--test/parallel/test-http-keep-alive.js6
-rw-r--r--test/parallel/test-http-upgrade-agent.js2
-rw-r--r--test/parallel/test-https-client-override-global-agent.js2
7 files changed, 12 insertions, 12 deletions
diff --git a/test/parallel/test-http-client-agent.js b/test/parallel/test-http-client-agent.js
index 3ae906f09c..77616edd99 100644
--- a/test/parallel/test-http-client-agent.js
+++ b/test/parallel/test-http-client-agent.js
@@ -46,8 +46,8 @@ server.listen(0, common.mustCall(() => {
}));
const countdown = new Countdown(max, () => {
- assert(!http.globalAgent.sockets.hasOwnProperty(name));
- assert(!http.globalAgent.requests.hasOwnProperty(name));
+ assert(!(name in http.globalAgent.sockets));
+ assert(!(name in http.globalAgent.requests));
server.close();
});
diff --git a/test/parallel/test-http-client-override-global-agent.js b/test/parallel/test-http-client-override-global-agent.js
index 0efaded5e4..f8b2928940 100644
--- a/test/parallel/test-http-client-override-global-agent.js
+++ b/test/parallel/test-http-client-override-global-agent.js
@@ -14,7 +14,7 @@ server.listen(0, common.mustCall(() => {
http.globalAgent = agent;
makeRequest();
- assert(agent.sockets.hasOwnProperty(name)); // Agent has indeed been used
+ assert(name in agent.sockets); // Agent has indeed been used
}));
function makeRequest() {
diff --git a/test/parallel/test-http-connect-req-res.js b/test/parallel/test-http-connect-req-res.js
index cd6e55e089..dfb83a41aa 100644
--- a/test/parallel/test-http-connect-req-res.js
+++ b/test/parallel/test-http-connect-req-res.js
@@ -43,8 +43,8 @@ server.listen(0, common.mustCall(function() {
// Make sure this request got removed from the pool.
const name = `localhost:${server.address().port}`;
- assert(!http.globalAgent.sockets.hasOwnProperty(name));
- assert(!http.globalAgent.requests.hasOwnProperty(name));
+ assert(!(name in http.globalAgent.sockets));
+ assert(!(name in http.globalAgent.requests));
// Make sure this socket has detached.
assert(!socket.ondata);
diff --git a/test/parallel/test-http-connect.js b/test/parallel/test-http-connect.js
index 47fd7316d0..b6053ba9d4 100644
--- a/test/parallel/test-http-connect.js
+++ b/test/parallel/test-http-connect.js
@@ -70,8 +70,8 @@ server.listen(0, common.mustCall(() => {
req.on('connect', common.mustCall((res, socket, firstBodyChunk) => {
// Make sure this request got removed from the pool.
const name = `localhost:${server.address().port}`;
- assert(!http.globalAgent.sockets.hasOwnProperty(name));
- assert(!http.globalAgent.requests.hasOwnProperty(name));
+ assert(!(name in http.globalAgent.sockets));
+ assert(!(name in http.globalAgent.requests));
// Make sure this socket has detached.
assert(!socket.ondata);
diff --git a/test/parallel/test-http-keep-alive.js b/test/parallel/test-http-keep-alive.js
index 42d534e8e6..bd075230d1 100644
--- a/test/parallel/test-http-keep-alive.js
+++ b/test/parallel/test-http-keep-alive.js
@@ -59,7 +59,7 @@ server.listen(0, common.mustCall(function() {
}, common.mustCall((response) => {
response.on('end', common.mustCall(() => {
assert.strictEqual(agent.sockets[name].length, 1);
- assert(!agent.requests.hasOwnProperty(name));
+ assert(!(name in agent.requests));
server.close();
}));
response.resume();
@@ -67,6 +67,6 @@ server.listen(0, common.mustCall(function() {
}));
process.on('exit', () => {
- assert(!agent.sockets.hasOwnProperty(name));
- assert(!agent.requests.hasOwnProperty(name));
+ assert(!(name in agent.sockets));
+ assert(!(name in agent.requests));
});
diff --git a/test/parallel/test-http-upgrade-agent.js b/test/parallel/test-http-upgrade-agent.js
index cb33edc32e..2849881949 100644
--- a/test/parallel/test-http-upgrade-agent.js
+++ b/test/parallel/test-http-upgrade-agent.js
@@ -78,7 +78,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() {
assert.deepStrictEqual(expectedHeaders, res.headers);
// Make sure this request got removed from the pool.
- assert(!http.globalAgent.sockets.hasOwnProperty(name));
+ assert(!(name in http.globalAgent.sockets));
req.on('close', common.mustCall(function() {
socket.end();
diff --git a/test/parallel/test-https-client-override-global-agent.js b/test/parallel/test-https-client-override-global-agent.js
index a4bb273275..8774e77bb9 100644
--- a/test/parallel/test-https-client-override-global-agent.js
+++ b/test/parallel/test-https-client-override-global-agent.js
@@ -25,7 +25,7 @@ server.listen(0, common.mustCall(() => {
https.globalAgent = agent;
makeRequest();
- assert(agent.sockets.hasOwnProperty(name)); // Agent has indeed been used
+ assert(name in agent.sockets); // Agent has indeed been used
}));
function makeRequest() {