mailjet / mailjet-apiv3-go

[API v3] Official Mailjet API v3 Go wrapper
https://dev.mailjet.com
MIT License
86 stars 31 forks source link

Please provide a mechanism to use a custom http.Client #95

Closed nam-truong-le closed 2 years ago

nam-truong-le commented 2 years ago

Currently the http.DefaultClient is used.

// NewHTTPClient returns a new httpClient
func NewHTTPClient(apiKeyPublic, apiKeyPrivate string) *HTTPClient {
    return &HTTPClient{
        apiKeyPublic:  apiKeyPublic,
        apiKeyPrivate: apiKeyPrivate,
        client:        http.DefaultClient,
    }
}

Changing the http.DefaultClient might affect other libs. It will be nice if it's possible to provide custom http.Client.

vtopc commented 2 years ago

What about (HTTPClient) SetClient(client http.Client)?

nam-truong-le commented 2 years ago

Thank you. I missed this information.