1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-11-24 12:00:05 -05:00

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.
This commit is contained in:
Aaron Lindsay 2020-11-17 09:18:40 -05:00
parent d88d45a664
commit 10edd94920
2 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ func (c *BasicClient) RawRequest(URL string, r io.Reader) (*http.Response, error
} }
if response.StatusCode != 200 { if response.StatusCode != 200 {
return nil, errors.New("OFXQuery request status: " + response.Status) return response, errors.New("OFXQuery request status: " + response.Status)
} }
return response, nil return response, nil

View File

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