mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 18:17:55 +00:00
Use the oauth2 context ability to specify a clean http client. (#2808)
Hopefully fixes #2793
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package github
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/google/go-github/github"
|
||||
"github.com/hashicorp/go-cleanhttp"
|
||||
"github.com/hashicorp/vault/logical"
|
||||
@@ -63,7 +65,8 @@ type backend struct {
|
||||
func (b *backend) Client(token string) (*github.Client, error) {
|
||||
tc := cleanhttp.DefaultClient()
|
||||
if token != "" {
|
||||
tc = oauth2.NewClient(oauth2.NoContext, &tokenSource{Value: token})
|
||||
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, tc)
|
||||
tc = oauth2.NewClient(ctx, &tokenSource{Value: token})
|
||||
}
|
||||
|
||||
return github.NewClient(tc), nil
|
||||
|
||||
Reference in New Issue
Block a user