mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 07:26:47 +00:00
* listenAddress updated to correctly set if RPC listens on any interface * Update restful_router.go
This commit is contained in:
@@ -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, "<html>GoCryptoTrader RESTful interface. For the web GUI, please visit the <a href=https://github.com/thrasher-/gocryptotrader/blob/master/web/README.md>web GUI readme.</a></html>")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user