Only set Authorization header when AccessToken is set

This commit is contained in:
Marian Steinbach 2021-11-16 14:50:42 +01:00 committed by mattn
parent 45d75e8085
commit 7745e19ff7

View File

@ -92,7 +92,10 @@ func (c *Client) streaming(ctx context.Context, p string, params url.Values) (ch
return nil, err return nil, err
} }
req = req.WithContext(ctx) req = req.WithContext(ctx)
req.Header.Set("Authorization", "Bearer "+c.Config.AccessToken)
if c.Config.AccessToken != "" {
req.Header.Set("Authorization", "Bearer "+c.Config.AccessToken)
}
q := make(chan Event) q := make(chan Event)
go func() { go func() {