Only set Authorization header when AccessToken is set

pull/145/head
Marian Steinbach 2021-11-16 14:50:42 +01:00 committed by mattn
parent 45d75e8085
commit 7745e19ff7
1 changed files with 4 additions and 1 deletions

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() {