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
// always be present in exactly this order, so a regular expression is acceptable.
headerExp := regexp.MustCompile(
`OFXHEADER:\s*(?P<OFXHEADER>\d+)\s*` +
`^OFXHEADER:\s*(?P<OFXHEADER>\d+)\s*` +
`DATA:\s*(?P<DATA>[A-Z]+)\s*` +
`VERSION:\s*(?P<VERSION>\d+)\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*` +
`COMPRESSION:\s*(?P<COMPRESSION>[A-Z]+)\s*` +
`OLDFILEUID:\s*(?P<OLDFILEUID>[\w-]+)\s*` +
`NEWFILEUID:\s*(?P<NEWFILEUID>[\w-]+)\s*`)
`NEWFILEUID:\s*(?P<NEWFILEUID>[\w-]+)\s*<$`)
matches := headerExp.FindStringSubmatch(s)
if len(matches) == 0 {

View File

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