Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ type service struct {
client *Client
}

// Client returns the http.Client used by this GitHub client.
func (c *Client) Client() *http.Client {
c.clientMu.Lock()
defer c.clientMu.Unlock()
clientCopy := *c.client
return &clientCopy
}

// ListOptions specifies the optional parameters to various List methods that
// support offset pagination.
type ListOptions struct {
Expand Down
8 changes: 8 additions & 0 deletions github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,14 @@ func TestNewClient(t *testing.T) {
}
}

func TestClient(t *testing.T) {
c := NewClient(nil)
c2 := c.Client()
if c.client == c2 {
t.Error("Client returned same http.Client, but should be different")
}
}

func TestNewEnterpriseClient(t *testing.T) {
baseURL := "https://custom-url/api/v3/"
uploadURL := "https://custom-upload-url/api/uploads/"
Expand Down