diff --git a/dist/index.js b/dist/index.js index ca84899..b56fd88 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4222,6 +4222,15 @@ RedirectableRequest.prototype._sanitizeOptions = function (options) { if (!options.headers) { options.headers = {}; } + // 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 (!isArray(options.sensitiveHeaders)) { options.sensitiveHeaders = []; } @@ -4621,7 +4630,7 @@ function isURL(value) { } function escapeRegex(regex) { - return regex.replace(/[\]\\/()*+?.$]/g, "\\$&"); + return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&"); } // Exports diff --git a/yarn.lock b/yarn.lock index cec51fd..9db36e1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -108,9 +108,9 @@ es-set-tostringtag@^2.1.0: hasown "^2.0.2" follow-redirects@^1.16.0: - version "1.16.1" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.16.1.tgz#6e0efa40a727fb369b98dab15883ec34787d675e" - integrity sha512-FNvFGzoMLWmE6Yj9spb/zjd7yiNCHiAW9/Tg9CXrQ8wuu32HtlJOwWO11OJafl5FfY3DxTdQ0vj42zU1kvv5jg== + version "1.16.2" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.16.2.tgz#a233160dd1bc9b16cbbab43709e6adc7cc941c8c" + integrity sha512-/kVP2U8z596Ia0gwFrwyIeo74ta5aVmSeU1FfAUMAmcEP5EP7zydmag3SLiN64NaRKef3lxsq7i/g7ltJQDGow== form-data@^4.0.6: version "4.0.6"