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

Commit

Permalink
Merge pull request #76 from paultyng/set-http-transport
Browse files Browse the repository at this point in the history
allow passing an http transport
  • Loading branch information
ctrombley committed Nov 13, 2019
2 parents 885cc8e + 8b1be82 commit d90cd08
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"net/http"

"github.com/tomnomnom/linkheader"

Expand Down Expand Up @@ -73,6 +74,9 @@ type Config struct {
// UserAgent is passed to the Resty client's SetHeaders to allow overriding
// the default user-agent header (go-newrelic/$version)
UserAgent string

// HttpTransport is passed to the Resty client's SetTransport method (optional).
HTTPTransport http.RoundTripper
}

// New returns a new Client for the specified apiKey.
Expand Down Expand Up @@ -106,6 +110,9 @@ func New(config Config) Client {
if config.Debug {
r.SetDebug(true)
}
if config.HTTPTransport != nil {
r.SetTransport(config.HTTPTransport)
}

c := Client{
RestyClient: r,
Expand Down

0 comments on commit d90cd08

Please sign in to comment.