Skip to content

Commit

Permalink
fix: org-less hack for list orgs call
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasmalkmus committed Aug 16, 2024
1 parent 5242e70 commit 9827bb6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion axiom/orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,18 @@ func (s *OrganizationsService) List(ctx context.Context) ([]*Organization, error
ctx, span := s.client.trace(ctx, "Organizations.List")
defer span.End()

req, err := s.client.NewRequest(ctx, http.MethodGet, s.basePath, nil)
if err != nil {
return nil, spanError(span, err)
}

// FIXME(lukasmalkmus): This is kind of a hack. This call is org-less but we
// have no way to configure an org-less client when used with a personal
// token. So we remove the organization header here.
req.Header.Del(headerOrganizationID)

var res []*wrappedOrganization
if err := s.client.Call(ctx, http.MethodGet, s.basePath, nil, &res); err != nil {
if _, err = s.client.Do(req, &res); err != nil {
return nil, spanError(span, err)
}

Expand Down

0 comments on commit 9827bb6

Please sign in to comment.