Skip to content

Commit fcc0503

Browse files
committed
noticed other code could be normalized too
1 parent fcaff50 commit fcc0503

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

edge-apis/urls.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,19 @@ const (
2828
// ClientUrl returns a URL with the given hostname in the format of `https://<hostname>/edge/management/v1`.
2929
// The hostname provided may include a port.
3030
func ClientUrl(hostname string) string {
31-
if !strings.Contains(hostname, "://") {
32-
hostname = "https://" + hostname
33-
}
3431
return concat(hostname, ClientApiPath)
3532
}
3633

3734
// ManagementUrl returns a URL with the given hostname in the format of `https://<hostname>/edge/management/v1`.
3835
// The hostname provided may include a port.
3936
func ManagementUrl(hostname string) string {
40-
if !strings.Contains(hostname, "://") {
41-
hostname = "https://" + hostname
42-
}
4337
return concat(hostname, ManagementApiPath)
4438
}
4539

4640
func concat(base, path string) string {
41+
if !strings.Contains(base, "://") {
42+
base = "https://" + base
43+
}
4744
if strings.HasSuffix(base, "/") {
4845
return strings.Trim(base, "/") + path
4946
}

0 commit comments

Comments
 (0)