Skip to content

Commit

Permalink
Enable adding custom HTTP visitors (#230)
Browse files Browse the repository at this point in the history
This PR expands client to be compatible with Terraform provider
  • Loading branch information
nfx authored Dec 7, 2022
1 parent c597576 commit 9f69eef
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ func (c *DatabricksClient) ConfiguredAccountID() string {
}

// Do sends an HTTP request against path.
func (c *DatabricksClient) Do(ctx context.Context, method string, path string, request interface{}, response interface{}) error {
body, err := c.perform(ctx, method, path, request, c.completeUrl)
func (c *DatabricksClient) Do(ctx context.Context, method, path string,
request, response any, visitors ...func(*http.Request) error) error {
body, err := c.perform(ctx, method, path, request, visitors...)
if err != nil {
return err
}
Expand Down Expand Up @@ -225,6 +226,7 @@ func (c *DatabricksClient) perform(ctx context.Context, method, requestURL strin
return nil, fmt.Errorf("request marshal: %w", err)
}
visitors = append([]func(*http.Request) error{
c.completeUrl,
c.Config.Authenticate,
c.addAuthHeaderToUserAgent,
}, visitors...)
Expand Down

0 comments on commit 9f69eef

Please sign in to comment.