Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function (url, options) {
if (/^\/\//.test(url)) {
url = 'https:' + url
}
return realFetch.call(this, url, options)
}
module.exports = function fetch(url, options) {
if (/^\/\//.test(url)) {
url = `https:${url}`;
}
return realFetch.call(this, url, options);
};
module.exports = function(url, options) {
if (/^\/\//.test(url)) {
url = 'https:' + url;
}
return realFetch.call(this, url, options);
};
global.fetch = function fetch(url, options) {
const normalized = (/^\/\//).test(url) ? `https:${url}` : url
return realFetch.call(this, normalized, options)
}
global.Response = realFetch.Response
module.exports = (url, options) => {
const secureUrl = (/^\/\//.test(url))
? `https:${url}`
: url;
return realFetch.call(this, secureUrl, options);
};
function wrappedFetch(url: string | Request, options) {
if (typeof url !== 'string') {
return nodeFetch.call(this, url, options);
}
const finalURL = url.startsWith('//') ? `https:${url}` : url;
return nodeFetch.call(this, finalURL, options);
}
function wrappedFetch(url: string | Request, options) {
if (typeof url !== 'string') {
return nodeFetch.call(this, url, options);
}
const finalURL = url.startsWith('//') ? `https:${url}` : url;
return nodeFetch.call(this, finalURL, options);
}