1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2024-11-23 03:40:04 -05:00

review changes

This commit is contained in:
Aaron Ross 2021-01-03 19:07:43 -08:00 committed by Aaron Lindsay
parent 9136c9bab2
commit 2b8a79e4b7
3 changed files with 3 additions and 4 deletions

View File

@ -54,7 +54,7 @@ func (or *Response) readSGMLHeaders(r *bufio.Reader) error {
// optionally captured & discarded by the trailing `\s*`. Valid SGML headers must // optionally captured & discarded by the trailing `\s*`. Valid SGML headers must
// always be present in exactly this order, so a regular expression is acceptable. // always be present in exactly this order, so a regular expression is acceptable.
headerExp := regexp.MustCompile( headerExp := regexp.MustCompile(
`OFXHEADER:\s*(?P<OFXHEADER>\d+)\s*` + `^OFXHEADER:\s*(?P<OFXHEADER>\d+)\s*` +
`DATA:\s*(?P<DATA>[A-Z]+)\s*` + `DATA:\s*(?P<DATA>[A-Z]+)\s*` +
`VERSION:\s*(?P<VERSION>\d+)\s*` + `VERSION:\s*(?P<VERSION>\d+)\s*` +
`SECURITY:\s*(?P<SECURITY>[\w]+)\s*` + `SECURITY:\s*(?P<SECURITY>[\w]+)\s*` +
@ -62,7 +62,7 @@ func (or *Response) readSGMLHeaders(r *bufio.Reader) error {
`CHARSET:\s*(?P<CHARSET>[\w-]+)\s*` + `CHARSET:\s*(?P<CHARSET>[\w-]+)\s*` +
`COMPRESSION:\s*(?P<COMPRESSION>[A-Z]+)\s*` + `COMPRESSION:\s*(?P<COMPRESSION>[A-Z]+)\s*` +
`OLDFILEUID:\s*(?P<OLDFILEUID>[\w-]+)\s*` + `OLDFILEUID:\s*(?P<OLDFILEUID>[\w-]+)\s*` +
`NEWFILEUID:\s*(?P<NEWFILEUID>[\w-]+)\s*`) `NEWFILEUID:\s*(?P<NEWFILEUID>[\w-]+)\s*<$`)
matches := headerExp.FindStringSubmatch(s) matches := headerExp.FindStringSubmatch(s)
if len(matches) == 0 { if len(matches) == 0 {

View File

@ -176,8 +176,7 @@ func TestValidSamples(t *testing.T) {
func TestInvalidResponse(t *testing.T) { func TestInvalidResponse(t *testing.T) {
// in this example, the severity is invalid due to mixed upper and lower case letters // in this example, the severity is invalid due to mixed upper and lower case letters
const invalidResponse = ` const invalidResponse = `OFXHEADER:100
OFXHEADER:100
DATA:OFXSGML DATA:OFXSGML
VERSION:102 VERSION:102
SECURITY:NONE SECURITY:NONE