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

allow passing an http transport #76

Merged
merged 1 commit into from
Nov 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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