Skip to content

Commit

Permalink
Fix websocket connections on test client
Browse files Browse the repository at this point in the history
  • Loading branch information
vektah committed Sep 25, 2019
1 parent c997ec0 commit ef24a1c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions client/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,15 @@ 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 {
return errorSubscription(fmt.Errorf("parse body: %s", err.Error()))
}

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()))
Expand Down

0 comments on commit ef24a1c

Please sign in to comment.