GetStream / stream-chat-go

Stream Chat official Golang API Client
https://getstream.io/chat/
BSD 3-Clause "New" or "Revised" License
67 stars 31 forks source link

NewClient panics when http.RoundTripper is *otelhttp.Transport #269

Open rahulsinghpatwal opened 6 months ago

rahulsinghpatwal commented 6 months ago

Expected Behavior: I should be able to construct a Go client instance with an http.Client where http.RoundTripper is *otelhttp.Transport

Actual Behavior: NewClient panics

getting below error on creating clent"-

panic: interface conversion: http.RoundTripper is otelhttp.Transport, not http.Transport goroutine 1 [running]: github.com/GetStream/stream-chat-go/v6.NewClient({0x13fa848, 0xc}, {0x1430def, 0x40}, {0x0, 0x0, 0x8?}) /home/Rahul/go/pkg/mod/github.com/!get!stream/stream-chat-go/v6@v6.9.0/client.go:80 +0x3ea

artback commented 3 months ago

changing the http.DefaultTransport can have unexpected side effects and is non recommended praxis in Go. Set the *http.Client and Http Roundtripper using SetClient