always use http scheme for localhost

fixes #758
This commit is contained in:
Nathan Youngman authored and bep committed 2015-01-01 23:57:29 +01:00
1 parent dd1001ceda
commit c6f4b09f65
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -152,6 +152,7 @@ func fixUrl(s string) (string, error) {
if serverAppend { if serverAppend {
if useLocalhost { if useLocalhost {
u.Host = fmt.Sprintf("localhost:%d", serverPort) u.Host = fmt.Sprintf("localhost:%d", serverPort)
u.Scheme = "http"
return u.String(), nil return u.String(), nil
} }
host := u.Host host := u.Host
+1 -1
View File
@@ -17,7 +17,7 @@ func TestFixUrl(t *testing.T) {
} }
tests := []data{ tests := []data{
{"Basic http localhost", "", "http://foo.com", true, 1313, "http://localhost:1313"}, {"Basic http localhost", "", "http://foo.com", true, 1313, "http://localhost:1313"},
{"Basic https localhost", "", "https://foo.com", true, 1313, "https://localhost:1313"}, {"Basic https production, http localhost", "", "https://foo.com", true, 1313, "http://localhost:1313"},
{"Basic subdir", "", "http://foo.com/bar", true, 1313, "http://localhost:1313/bar"}, {"Basic subdir", "", "http://foo.com/bar", true, 1313, "http://localhost:1313/bar"},
{"Basic production", "http://foo.com", "http://foo.com", false, 80, "http://foo.com"}, {"Basic production", "http://foo.com", "http://foo.com", false, 80, "http://foo.com"},
{"Production subdir", "http://foo.com/bar", "http://foo.com/bar", false, 80, "http://foo.com/bar"}, {"Production subdir", "http://foo.com/bar", "http://foo.com/bar", false, 80, "http://foo.com/bar"},