Skip to content

Commit cdc8ba1

Browse files
committed
Only set Authorization when token is available
1 parent 98a62fd commit cdc8ba1

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

github/github.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ func (c *Client) WithAuthToken(token string) *Client {
354354
c2.client.Transport = roundTripperFunc(
355355
func(req *http.Request) (*http.Response, error) {
356356
req = req.Clone(req.Context())
357-
req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token))
357+
if token != "" {
358+
req.Header.Set("Authorization", fmt.Sprintf("Bearer %v", token))
359+
}
358360
return transport.RoundTrip(req)
359361
},
360362
)

0 commit comments

Comments
 (0)