diff --git a/restful_router.go b/restful_router.go index 9d33ed81..91e27799 100644 --- a/restful_router.go +++ b/restful_router.go @@ -3,6 +3,7 @@ package main import ( "fmt" "net/http" + "strconv" "time" "github.com/gorilla/mux" @@ -51,7 +52,8 @@ func NewRouter() *mux.Router { if common.ExtractPort(bot.config.Webserver.ListenAddress) == 80 { listenAddr = common.ExtractHost(bot.config.Webserver.ListenAddress) } else { - listenAddr = bot.config.Webserver.ListenAddress + listenAddr = common.JoinStrings([]string{common.ExtractHost(bot.config.Webserver.ListenAddress), + strconv.Itoa(common.ExtractPort(bot.config.Webserver.ListenAddress))}, ":") } routes = Routes{ @@ -136,5 +138,4 @@ func NewRouter() *mux.Router { func getIndex(w http.ResponseWriter, _ *http.Request) { fmt.Fprint(w, "GoCryptoTrader RESTful interface. For the web GUI, please visit the web GUI readme.") - w.WriteHeader(http.StatusOK) } diff --git a/restful_server_test.go b/restful_server_test.go index b3d7fc69..387ec732 100644 --- a/restful_server_test.go +++ b/restful_server_test.go @@ -72,7 +72,7 @@ func TestValidHostRequest(t *testing.T) { if err != nil { t.Fatal(err) } - req.Host = bot.config.Webserver.ListenAddress + req.Host = "localhost:9050" resp := httptest.NewRecorder() NewRouter().ServeHTTP(resp, req)