Skip to content

Commit 10edd94

Browse files
committed
Vanguard client: Accept 500 errors on initial response
Though their server returns a 500 HTTP status code, it still sets the required cookies on the response that we can use to make a second request.
1 parent d88d45a commit 10edd94

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

basic_client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (c *BasicClient) RawRequest(URL string, r io.Reader) (*http.Response, error
7474
}
7575

7676
if response.StatusCode != 200 {
77-
return nil, errors.New("OFXQuery request status: " + response.Status)
77+
return response, errors.New("OFXQuery request status: " + response.Status)
7878
}
7979

8080
return response, nil

vanguard_client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (c *VanguardClient) RequestNoParse(r *Request) (*http.Response, error) {
6464
// Fortunately, the initial response contains the cookie we need, so if we
6565
// detect an empty response with cookies set that didn't have any errors,
6666
// re-try the request while sending their cookies back to them.
67-
if err == nil && response.ContentLength <= 0 && len(response.Cookies()) > 0 {
67+
if response != nil && response.ContentLength <= 0 && len(response.Cookies()) > 0 {
6868
b, err = r.Marshal()
6969
if err != nil {
7070
return nil, err

0 commit comments

Comments
 (0)