feat: rename HttpCustomizer to HttpTransportCustomizer and make it return http.Transport that is later used (#30)

* feat: rename HttpCustomizer to HttpTransportCustomizer and make it return http.Transport that is later used

* linting
This commit is contained in:
Mateusz Filipowicz
2025-02-19 01:03:21 +01:00
committed by GitHub
parent e25b426a84
commit 7c7ef98c03
6 changed files with 39 additions and 58 deletions

View File

@@ -90,9 +90,9 @@ func TestCustomizeHttpClient(t *testing.T) {
_, err := NewClient(&ClientConfig{
URL: localUrl,
APIKey: "test-key",
HttpCustomizer: func(transport *http.Transport) error {
HttpTransportCustomizer: func(transport *http.Transport) (*http.Transport, error) {
called = true
return nil
return transport, nil
},
})
@@ -850,16 +850,16 @@ func TestLoginWithAPIKeyDirect(t *testing.T) {
assert.NoError(t, err)
}
func TestHttpCustomizerError(t *testing.T) {
func TestHttpTransportCustomizerError(t *testing.T) {
t.Parallel()
customizer := func(transport *http.Transport) error {
return errors.New("customization failed")
customizer := func(transport *http.Transport) (*http.Transport, error) {
return nil, errors.New("customization failed")
}
_, err := NewClient(&ClientConfig{
URL: testUrl,
APIKey: "test-key",
VerifySSL: false,
HttpCustomizer: customizer,
URL: testUrl,
APIKey: "test-key",
VerifySSL: false,
HttpTransportCustomizer: customizer,
})
require.Error(t, err)
assert.Contains(t, err.Error(), "failed customizing HTTP transport")