Fix the TypeError of isValidTLSArray for http (https://github.com/oven-sh/bun/issues/7153) (#7154)

This commit is contained in:
HK-SHAO
2023-11-17 15:41:19 +08:00
committed by GitHub
parent d1436e3ecc
commit 606c80b049

View File

@@ -96,11 +96,13 @@ function isValidTLSArray(obj) {
if (typeof obj === "string" || isTypedArray(obj) || obj instanceof ArrayBuffer || obj instanceof Blob) return true;
if (Array.isArray(obj)) {
for (var i = 0; i < obj.length; i++) {
if (typeof obj !== "string" && !isTypedArray(obj) && !(obj instanceof ArrayBuffer) && !(obj instanceof Blob))
const item = obj[i];
if (typeof item !== "string" && !isTypedArray(item) && !(item instanceof ArrayBuffer) && !(item instanceof Blob))
return false;
}
return true;
}
return false;
}
class ERR_INVALID_ARG_TYPE extends TypeError {