-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/improvement/BKTCLT-35-goClientCu…
…stomHTTPClient' into w/8.1/improvement/BKTCLT-35-goClientCustomHTTPClient
- Loading branch information
Showing
3 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,30 @@ | ||
package bucketclient | ||
|
||
import ( | ||
"net/http" | ||
) | ||
|
||
type BucketClient struct { | ||
*http.Client | ||
Endpoint string | ||
Metrics *BucketClientMetrics | ||
} | ||
|
||
// New creates a new BucketClient instance, with the provided endpoint (e.g. "localhost:9000") | ||
// and the default HTTP client. | ||
func New(bucketdEndpoint string) *BucketClient { | ||
bc := &BucketClient{ | ||
Client: http.DefaultClient, | ||
Endpoint: bucketdEndpoint, | ||
} | ||
return bc | ||
} | ||
|
||
// NewWithHTTPClient creates a new BucketClient instance, with the provided endpoint | ||
// (e.g. "localhost:9000") using the provided http.Client instance. | ||
func NewWithHTTPClient(bucketdEndpoint string, httpClient *http.Client) *BucketClient { | ||
return &BucketClient{ | ||
Client: httpClient, | ||
Endpoint: bucketdEndpoint, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters