provider/github: Log HTTP requests and responses in DEBUG mode (#14363)

This commit is contained in:
Radek Simko 2017-05-11 13:06:05 +02:00 committed by GitHub
parent 90db0ff119
commit 23c004b689
1 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"net/url"
"github.com/google/go-github/github"
"github.com/hashicorp/terraform/helper/logging"
"golang.org/x/oauth2"
)
@ -27,6 +28,8 @@ func (c *Config) Client() (interface{}, error) {
)
tc := oauth2.NewClient(oauth2.NoContext, ts)
tc.Transport = logging.NewTransport("Github", tc.Transport)
org.client = github.NewClient(tc)
if c.BaseURL != "" {
u, err := url.Parse(c.BaseURL)
@ -35,5 +38,6 @@ func (c *Config) Client() (interface{}, error) {
}
org.client.BaseURL = u
}
return &org, nil
}