1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2025-07-01 19:58:37 -04:00

Make setting request fields from Client a Request method

This also makes it possible to call this method for testing without
making an HTTP request.
This commit is contained in:
2017-03-28 20:42:22 -04:00
parent 3091a97b2c
commit 119c01f99b
2 changed files with 16 additions and 8 deletions

View File

@ -4,7 +4,6 @@ import (
"errors"
"io"
"net/http"
"time"
)
type Client struct {
@ -83,13 +82,7 @@ func RawRequest(URL string, r io.Reader) (*http.Response, error) {
// Caveat: The caller is responsible for closing the http Response.Body (see
// the http module's documentation for more information)
func (c *Client) RequestNoParse(r *Request) (*http.Response, error) {
r.Signon.DtClient = Date(time.Now())
// Overwrite fields that the client controls
r.Version = c.OfxVersion()
r.Signon.AppId = c.Id()
r.Signon.AppVer = c.Version()
r.indent = c.IndentRequests()
r.SetClientFields(c)
b, err := r.Marshal()
if err != nil {