1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2026-01-07 14:01:17 -05:00

Allow use of custom http.Client.

One purpose for this is to allow specifying a proxy.
This commit is contained in:
David Bartley
2025-12-14 00:35:46 -08:00
committed by Aaron Lindsay
parent 7af155fd1e
commit 2f015dc78a
2 changed files with 39 additions and 1 deletions

31
basic_client_test.go Normal file
View File

@@ -0,0 +1,31 @@
package ofxgo
import (
"errors"
"net"
"net/http"
"strings"
"testing"
)
func TestBasicClient_HTTPClient(t *testing.T) {
c := &BasicClient{
HTTPClient: &http.Client{
Transport: &http.Transport{
Dial: func(network, addr string) (net.Conn, error) {
return nil, errors.New("bad test client")
},
},
},
}
_, err := c.Request(&Request{
URL: "https://test",
Signon: SignonRequest{
UserID: "test",
UserPass: "test",
},
})
if err == nil || !strings.Contains(err.Error(), "bad test client") {
t.Fatalf("expected error containing 'bad test client', got: %v", err)
}
}