fix: Check for a response body when dialing the Tailnet WebSocket (#4327)

There was a panic in this code that caused it to fail on error!
This commit is contained in:
Kyle Carberry
2022-10-04 19:46:59 -05:00
committed by GitHub
parent 8940ea179e
commit 504cd462a7

View File

@ -387,7 +387,7 @@ func (c *Client) DialWorkspaceAgentTailnet(ctx context.Context, logger slog.Logg
CompressionMode: websocket.CompressionDisabled,
})
if isFirst {
if err != nil && res.StatusCode == http.StatusConflict {
if res != nil && res.StatusCode == http.StatusConflict {
first <- readBodyAsError(res)
return
}