Remove Port from registry

This commit is contained in:
Asim Aslam
2019-07-08 08:01:42 +01:00
parent 5b7454e5a8
commit e0bf1c2283
35 changed files with 92 additions and 228 deletions

View File

@@ -73,7 +73,7 @@ func (h *httpHandler) getService(r *http.Request) (string, error) {
return "", nil
}
return fmt.Sprintf("http://%s:%d", s.Address, s.Port), nil
return fmt.Sprintf("http://%s", s.Address), nil
}
func (h *httpHandler) String() string {

View File

@@ -4,8 +4,6 @@ import (
"net"
"net/http"
"net/http/httptest"
"strconv"
"strings"
"testing"
"github.com/micro/go-micro/api/handler"
@@ -26,21 +24,12 @@ func testHttp(t *testing.T, path, service, ns string) {
}
defer l.Close()
parts := strings.Split(l.Addr().String(), ":")
var host string
var port int
host = parts[0]
port, _ = strconv.Atoi(parts[1])
s := &registry.Service{
Name: service,
Nodes: []*registry.Node{
&registry.Node{
Id: service + "-1",
Address: host,
Port: port,
Address: l.Addr().String(),
},
},
}

View File

@@ -79,7 +79,7 @@ func (wh *webHandler) getService(r *http.Request) (string, error) {
return "", nil
}
return fmt.Sprintf("http://%s:%d", s.Address, s.Port), nil
return fmt.Sprintf("http://%s", s.Address), nil
}
// serveWebSocket used to serve a web socket proxied connection