Fix isHttpConnection check (#1526)

This commit is contained in:
Tomas Della Vedova
2021-08-20 12:40:25 +02:00
committed by GitHub
parent f161946984
commit a0dcace7cd
2 changed files with 32 additions and 2 deletions

View File

@ -323,9 +323,9 @@ function getAuth (node) {
function isHttpConnection (node) {
if (Array.isArray(node)) {
return node.some((n) => new URL(n).protocol === 'http:')
return node.some((n) => (typeof n === 'string' ? new URL(n).protocol : n.url.protocol) === 'http:')
} else {
return new URL(node).protocol === 'http:'
return (typeof node === 'string' ? new URL(node).protocol : node.url.protocol) === 'http:'
}
}