Function
getDomainName
(fullURL, host, path string, port int)
Source from the content-addressed store, hash-verified
| 461 | } |
| 462 | |
| 463 | func getDomainName(fullURL, host, path string, port int) string { |
| 464 | domainWithoutHost := strings.TrimPrefix(fullURL, host+".") |
| 465 | domainWithoutPath := strings.TrimSuffix(domainWithoutHost, path) |
| 466 | |
| 467 | if port > 0 { |
| 468 | portString := strconv.Itoa(port) |
| 469 | domainWithoutPort := strings.TrimSuffix(domainWithoutPath, ":"+portString) |
| 470 | return domainWithoutPort |
| 471 | } |
| 472 | |
| 473 | return domainWithoutPath |
| 474 | } |
Tested by
no test coverage detected