TUN-890: To support free tunnels, hostname can now be ""

This commit is contained in:
Adam Chalmers
2018-09-11 11:47:36 -05:00
committed by Areg Harutyunyan
parent 4f04f35bd1
commit d0bc4d0d96
4 changed files with 3 additions and 26 deletions

View File

@@ -15,7 +15,7 @@ var supportedProtocol = [2]string{"http", "https"}
func ValidateHostname(hostname string) (string, error) {
if hostname == "" {
return "", fmt.Errorf("Hostname should not be empty")
return "", nil
}
// users gives url(contains schema) not just hostname
if strings.Contains(hostname, ":") || strings.Contains(hostname, "%3A") {

View File

@@ -10,7 +10,7 @@ import (
func TestValidateHostname(t *testing.T) {
var inputHostname string
hostname, err := ValidateHostname(inputHostname)
assert.Equal(t, err, fmt.Errorf("Hostname should not be empty"))
assert.Equal(t, err, nil)
assert.Empty(t, hostname)
inputHostname = "hello.example.com"