Skip to content

Commit 0e8d46d

Browse files
committed
Warn users against setting Timeout on http.Client
Closes #67
1 parent 9398f34 commit 0e8d46d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dial.go

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ func dial(ctx context.Context, u string, opts DialOptions) (_ *Conn, _ *http.Res
4747
if opts.HTTPClient == nil {
4848
opts.HTTPClient = http.DefaultClient
4949
}
50+
if opts.HTTPClient.Timeout > 0 {
51+
return nil, nil, xerrors.Errorf("please use context for cancellation instead of http.Client.Timeout; see issue nhooyr.io/websocket#67")
52+
}
5053
if opts.HTTPHeader == nil {
5154
opts.HTTPHeader = http.Header{}
5255
}

0 commit comments

Comments
 (0)