From 1c7f11798e4cfcc3138072f607179571bd9619e7 Mon Sep 17 00:00:00 2001 From: Corey Butler Date: Mon, 12 Sep 2022 22:36:21 -0500 Subject: [PATCH] Added optional support for allowing unauthorized TLS/SSL certificate requests in runtimes which support it. --- src/lib/fetch/node.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/fetch/node.js b/src/lib/fetch/node.js index dd46384..af948fb 100644 --- a/src/lib/fetch/node.js +++ b/src/lib/fetch/node.js @@ -104,6 +104,12 @@ export default function Fetch (resource, init = {}) { delete init.signal const net = (resource.protocol === 'https:' ? https : http) + if (resource.protocol === 'https' && init.rejectUnauthorized === false && !init.hasOwnProperty('agent')) { + init.agent = new net.Agent({ + rejectUnauthorized: false + }) + } + const req = net.request(resource.href, init, res => { let body = ''