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

Omit end tags for encoding OFX 100-series requests

Closes https://github.com/aclindsa/ofxgo/issues/18
This commit is contained in:
John Starich
2019-06-14 20:20:08 -05:00
committed by Aaron Lindsay
parent 66dd37781f
commit 212fdc731b
4 changed files with 22 additions and 16 deletions

View File

@ -7,7 +7,8 @@ import (
"testing"
)
var ignoreSpacesRe = regexp.MustCompile(">[ \t\r\n]+<")
// match leading and trailing whitespace on each line
var ignoreSpacesRe = regexp.MustCompile("(?m)^[ \t]+|[ \t]*$[\r\n]+")
func marshalCheckRequest(t *testing.T, request *ofxgo.Request, expected string) {
t.Helper()
@ -18,8 +19,8 @@ func marshalCheckRequest(t *testing.T, request *ofxgo.Request, expected string)
actualString := buf.String()
// Ignore spaces between XML elements
expectedString := ignoreSpacesRe.ReplaceAllString(expected, "><")
actualString = ignoreSpacesRe.ReplaceAllString(actualString, "><")
expectedString := ignoreSpacesRe.ReplaceAllString(expected, "")
actualString = ignoreSpacesRe.ReplaceAllString(actualString, "")
if expectedString != actualString {
compareLength := len(expectedString)