Use cleanhttp instead of bare http.Client

This commit is contained in:
Jeff Mitchell
2015-10-22 14:37:12 -04:00
parent 6c4e05dbc0
commit 5c0a16b16a
6 changed files with 17 additions and 14 deletions

View File

@@ -1,9 +1,8 @@
package github
import (
"net/http"
"github.com/google/go-github/github"
"github.com/hashicorp/go-cleanhttp"
"github.com/hashicorp/vault/logical"
"github.com/hashicorp/vault/logical/framework"
"golang.org/x/oauth2"
@@ -54,7 +53,7 @@ type backend struct {
// Client returns the GitHub client to communicate to GitHub via the
// configured settings.
func (b *backend) Client(token string) (*github.Client, error) {
tc := &http.Client{}
tc := cleanhttp.DefaultClient()
if token != "" {
tc = oauth2.NewClient(oauth2.NoContext, &tokenSource{Value: token})
}