From ef24a1cc1e144f73c9fc71eb514ea67478ac504c Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 25 Sep 2019 13:57:54 +1000 Subject: [PATCH] Fix websocket connections on test client --- client/websocket.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client/websocket.go b/client/websocket.go index 250901bca92..35c74dddcd3 100644 --- a/client/websocket.go +++ b/client/websocket.go @@ -55,7 +55,6 @@ func (p *Client) WebsocketWithPayload(query string, initPayload map[string]inter if err != nil { return errorSubscription(fmt.Errorf("request: %s", err.Error())) } - r.Header.Set("Host", "99designs.com") requestBody, err := ioutil.ReadAll(r.Body) if err != nil { @@ -63,10 +62,8 @@ func (p *Client) WebsocketWithPayload(query string, initPayload map[string]inter } srv := httptest.NewServer(p.h) - url := strings.Replace(srv.URL, "http://", "ws://", -1) - url = strings.Replace(url, "https://", "wss://", -1) - - c, _, err := websocket.DefaultDialer.Dial(url, r.Header) + host := strings.Replace(srv.URL, "http://", "ws://", -1) + c, _, err := websocket.DefaultDialer.Dial(host+r.URL.Path, r.Header) if err != nil { return errorSubscription(fmt.Errorf("dial: %s", err.Error()))