mirror of
				https://github.com/aclindsa/ofxgo.git
				synced 2025-11-03 18:03:25 -05:00 
			
		
		
		
	client: Add RequestNoParse()
This commit is contained in:
		
							
								
								
									
										29
									
								
								client.go
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								client.go
									
									
									
									
									
								
							@@ -75,15 +75,14 @@ func RawRequest(URL string, r io.Reader) (*http.Response, error) {
 | 
				
			|||||||
	return response, nil
 | 
						return response, nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Request marshals a Request object into XML, makes an HTTP request against
 | 
					// RequestNoParse marshals a Request object into XML, makes an HTTP request,
 | 
				
			||||||
// it's URL, and then unmarshals the response into a Response object.
 | 
					// and returns the raw HTTP response. Unlike RawRequest(), it takes client
 | 
				
			||||||
 | 
					// settings into account. Unlike Request(), it doesn't parse the response into
 | 
				
			||||||
 | 
					// a Request object.
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Before being marshaled, some of the the Request object's values are
 | 
					// Caveat: The caller is responsible for closing the http Response.Body (see
 | 
				
			||||||
// overwritten, namely those dictated by the Client's configuration (Version,
 | 
					// the http module's documentation for more information)
 | 
				
			||||||
// AppId, AppVer fields), and the client's curren time (DtClient). These are
 | 
					func (c *Client) RequestNoParse(r *Request) (*http.Response, error) {
 | 
				
			||||||
// updated in place in the supplied Request object so they may later be
 | 
					 | 
				
			||||||
// inspected by the caller.
 | 
					 | 
				
			||||||
func (c *Client) Request(r *Request) (*Response, error) {
 | 
					 | 
				
			||||||
	r.Signon.DtClient = Date(time.Now())
 | 
						r.Signon.DtClient = Date(time.Now())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Overwrite fields that the client controls
 | 
						// Overwrite fields that the client controls
 | 
				
			||||||
@@ -97,7 +96,19 @@ func (c *Client) Request(r *Request) (*Response, error) {
 | 
				
			|||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	response, err := RawRequest(r.URL, b)
 | 
						return RawRequest(r.URL, b)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Request marshals a Request object into XML, makes an HTTP request against
 | 
				
			||||||
 | 
					// it's URL, and then unmarshals the response into a Response object.
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					// Before being marshaled, some of the the Request object's values are
 | 
				
			||||||
 | 
					// overwritten, namely those dictated by the Client's configuration (Version,
 | 
				
			||||||
 | 
					// AppId, AppVer fields), and the client's curren time (DtClient). These are
 | 
				
			||||||
 | 
					// updated in place in the supplied Request object so they may later be
 | 
				
			||||||
 | 
					// inspected by the caller.
 | 
				
			||||||
 | 
					func (c *Client) Request(r *Request) (*Response, error) {
 | 
				
			||||||
 | 
						response, err := c.RequestNoParse(r)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user