LearningSalesForceCommerceC.../storefront-reference-architecture/test/integration/helpers/urlUtils.js

19 lines
462 B
JavaScript
Raw Normal View History

2021-12-21 10:57:31 -08:00
function urlUtils() {}
/**
* Strips auth basic authentication parameters - if set - and returns the url
*
* @param {String} url - Url string
* @returns {String}
*/
urlUtils.stripBasicAuth = function (url) {
var sfIndex = url.indexOf('storefront');
var atIndex = url.indexOf('@');
if (sfIndex > -1 && atIndex > -1) {
return url.slice(0, sfIndex) + url.slice(atIndex + 1, url.length);
}
return url;
};
module.exports = urlUtils;