Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Add HTTP transport debugging using terraform's helper (PagerDuty#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdecat authored and heimweh committed Nov 16, 2017
1 parent 40585f1 commit 0b32f5e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pagerduty/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pagerduty
import (
"fmt"
"log"
"net/http"
"runtime"

"github.com/hashicorp/terraform/helper/logging"
Expand Down Expand Up @@ -33,10 +34,15 @@ func (c *Config) Client() (*pagerduty.Client, error) {
return nil, fmt.Errorf(invalidCreds)
}

var httpClient *http.Client
httpClient = http.DefaultClient
httpClient.Transport = logging.NewTransport("PagerDuty", http.DefaultTransport)

config := &pagerduty.Config{
Debug: logging.IsDebugOrHigher(),
Token: c.Token,
UserAgent: fmt.Sprintf("(%s %s) Terraform/%s", runtime.GOOS, runtime.GOARCH, terraform.VersionString()),
Debug: logging.IsDebugOrHigher(),
HTTPClient: httpClient,
Token: c.Token,
UserAgent: fmt.Sprintf("(%s %s) Terraform/%s", runtime.GOOS, runtime.GOARCH, terraform.VersionString()),
}

client, err := pagerduty.NewClient(config)
Expand Down

0 comments on commit 0b32f5e

Please sign in to comment.