Skip to content
Open
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
9 changes: 8 additions & 1 deletion github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,11 @@ func (c *Client) initialize() {
c.Issues = (*IssuesService)(&c.common)
c.Licenses = (*LicensesService)(&c.common)
c.Markdown = (*MarkdownService)(&c.common)
c.Marketplace = &MarketplaceService{client: c}
var marketplaceStubbed bool
if c.Marketplace != nil {
marketplaceStubbed = c.Marketplace.Stubbed
}
c.Marketplace = &MarketplaceService{client: c, Stubbed: marketplaceStubbed}
c.Meta = (*MetaService)(&c.common)
c.Migrations = (*MigrationService)(&c.common)
c.Organizations = (*OrganizationsService)(&c.common)
Expand Down Expand Up @@ -498,6 +502,9 @@ func (c *Client) copy() *Client {
RateLimitRedirectionalEndpoints: c.RateLimitRedirectionalEndpoints,
secondaryRateLimitReset: c.secondaryRateLimitReset,
}
if c.Marketplace != nil {
clone.Marketplace = &MarketplaceService{Stubbed: c.Marketplace.Stubbed}
}
c.clientMu.Unlock()
if c.client != nil {
clone.client.Transport = c.client.Transport
Expand Down
13 changes: 13 additions & 0 deletions github/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,19 @@ func TestWithAuthToken(t *testing.T) {
t.Error("The header 'Authorization' must not be set")
}
})

t.Run("preserves Marketplace Stubbed field", func(t *testing.T) {
t.Parallel()

c := NewClient(nil)
c.Marketplace.Stubbed = true

c2 := c.WithAuthToken("token")

if !c2.Marketplace.Stubbed {
t.Fatal("WithAuthToken reset Marketplace.Stubbed; want true")
}
})
}

func TestWithEnterpriseURLs(t *testing.T) {
Expand Down
Loading