diff --git a/dist/index.js b/dist/index.js index b5b75ea..b6efec1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -8140,7 +8140,16 @@ RedirectableRequest.prototype._sanitizeOptions = function (options) { if (!options.headers) { options.headers = {}; } - if (!isArray(options.sensitiveHeaders)) { + // Convert [header1, value1, header2, value2, …] to object + else if (Array.isArray(options.headers)) { + var headerList = options.headers; + options.headers = {}; + for (var i = 0; i < headerList.length; i += 2) { + options.headers[headerList[i]] = headerList[i + 1]; + } + } + // Ensure sensitive headers are always present + if (!Array.isArray(options.sensitiveHeaders)) { options.sensitiveHeaders = []; } @@ -8518,10 +8527,6 @@ function isSubdomain(subdomain, domain) { return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain); } -function isArray(value) { - return value instanceof Array; -} - function isString(value) { return typeof value === "string" || value instanceof String; } @@ -8539,7 +8544,7 @@ function isURL(value) { } function escapeRegex(regex) { - return regex.replace(/[\]\\/()*+?.$]/g, "\\$&"); + return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&"); } // Exports diff --git a/package-lock.json b/package-lock.json index ae8f9a4..aef89a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -536,9 +536,9 @@ "license": "MIT" }, "node_modules/follow-redirects": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", - "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.2.tgz", + "integrity": "sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow==", "funding": [ { "type": "individual",