Use regex instead of startsWith which is unsupported in node 0.10

This commit is contained in:
Daniel Rozenberg 2020-01-28 19:40:51 -05:00
parent b309db074f
commit 7ec9b70180

View File

@ -42,7 +42,7 @@ function parse(str) {
// If the host is missing it might be a URL-encoded path to a socket.
var pathname = result.pathname;
if (!config.host && pathname && pathname.toLowerCase().startsWith('%2f')) {
if (!config.host && pathname && /^%2f/i.test(pathname)) {
var pathnameSplit = pathname.split('/');
config.host = decodeURIComponent(pathnameSplit[0]);
pathname = pathnameSplit.splice(1).join('/');