File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,14 @@ type service struct {
188
188
client * Client
189
189
}
190
190
191
+ // Client returns the http.Client used by this GitHub client.
192
+ func (c * Client ) Client () * http.Client {
193
+ c .clientMu .Lock ()
194
+ defer c .clientMu .Unlock ()
195
+ clientCopy := * c .client
196
+ return & clientCopy
197
+ }
198
+
191
199
// ListOptions specifies the optional parameters to various List methods that
192
200
// support offset pagination.
193
201
type ListOptions struct {
Original file line number Diff line number Diff line change @@ -232,6 +232,14 @@ func TestNewClient(t *testing.T) {
232
232
}
233
233
}
234
234
235
+ func TestClient (t * testing.T ) {
236
+ c := NewClient (nil )
237
+ c2 := c .Client ()
238
+ if c .client == c2 {
239
+ t .Error ("Client returned same http.Client, but should be different" )
240
+ }
241
+ }
242
+
235
243
func TestNewEnterpriseClient (t * testing.T ) {
236
244
baseURL := "https://custom-url/api/v3/"
237
245
uploadURL := "https://custom-upload-url/api/uploads/"
You can’t perform that action at this time.
0 commit comments