1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2026-01-04 21:11:18 -05:00
Files
ofxgo/basic_client_test.go
David Bartley 2f015dc78a Allow use of custom http.Client.
One purpose for this is to allow specifying a proxy.
2025-12-17 07:29:47 -05:00

32 lines
607 B
Go

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)
}
}