File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -467,7 +467,11 @@ func (c *Client) initialize() {
467467 c .Issues = (* IssuesService )(& c .common )
468468 c .Licenses = (* LicensesService )(& c .common )
469469 c .Markdown = (* MarkdownService )(& c .common )
470- c .Marketplace = & MarketplaceService {client : c }
470+ var marketplaceStubbed bool
471+ if c .Marketplace != nil {
472+ marketplaceStubbed = c .Marketplace .Stubbed
473+ }
474+ c .Marketplace = & MarketplaceService {client : c , Stubbed : marketplaceStubbed }
471475 c .Meta = (* MetaService )(& c .common )
472476 c .Migrations = (* MigrationService )(& c .common )
473477 c .Organizations = (* OrganizationsService )(& c .common )
@@ -498,6 +502,9 @@ func (c *Client) copy() *Client {
498502 RateLimitRedirectionalEndpoints : c .RateLimitRedirectionalEndpoints ,
499503 secondaryRateLimitReset : c .secondaryRateLimitReset ,
500504 }
505+ if c .Marketplace != nil {
506+ clone .Marketplace = & MarketplaceService {Stubbed : c .Marketplace .Stubbed }
507+ }
501508 c .clientMu .Unlock ()
502509 if c .client != nil {
503510 clone .client .Transport = c .client .Transport
Original file line number Diff line number Diff line change @@ -508,6 +508,19 @@ func TestWithAuthToken(t *testing.T) {
508508 t .Error ("The header 'Authorization' must not be set" )
509509 }
510510 })
511+
512+ t .Run ("preserves Marketplace Stubbed field" , func (t * testing.T ) {
513+ t .Parallel ()
514+
515+ c := NewClient (nil )
516+ c .Marketplace .Stubbed = true
517+
518+ c2 := c .WithAuthToken ("token" )
519+
520+ if ! c2 .Marketplace .Stubbed {
521+ t .Fatal ("WithAuthToken reset Marketplace.Stubbed; want true" )
522+ }
523+ })
511524}
512525
513526func TestWithEnterpriseURLs (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments