| 122 | } |
| 123 | |
| 124 | func (a *ApplicationURL) ChangePortProtocol(target string) ApplicationURL { |
| 125 | newAppURL := *a |
| 126 | port, protocol, isPort := a.PortInfo() |
| 127 | if !isPort { |
| 128 | return newAppURL |
| 129 | } |
| 130 | |
| 131 | if target == protocol { |
| 132 | return newAppURL |
| 133 | } |
| 134 | |
| 135 | if target == "https" { |
| 136 | newAppURL.AppSlugOrPort = fmt.Sprintf("%ds", port) |
| 137 | } |
| 138 | |
| 139 | if target == "http" { |
| 140 | newAppURL.AppSlugOrPort = fmt.Sprintf("%d", port) |
| 141 | } |
| 142 | |
| 143 | return newAppURL |
| 144 | } |
| 145 | |
| 146 | // ParseSubdomainAppURL parses an ApplicationURL from the given subdomain. If |
| 147 | // the subdomain is not a valid application URL hostname, returns a non-nil |