feat: better errors when server fails

This commit is contained in:
thecodrr
2022-01-18 12:00:57 +05:00
parent 17eeaeb72c
commit 2e50130c16
3 changed files with 57 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
export function extractHostname(url) {
var hostname;
//find & remove protocol (http, ftp, etc.) and get hostname
if (url.indexOf("//") > -1) {
hostname = url.split("/")[2];
} else {
hostname = url.split("/")[0];
}
//find & remove port number
// hostname = hostname.split(":")[0];
//find & remove "?"
hostname = hostname.split("?")[0];
return hostname;
}