mirror of
https://github.com/aclindsa/ofxgo.git
synced 2024-10-30 05:20:05 -04:00
review changes
This commit is contained in:
parent
9136c9bab2
commit
2b8a79e4b7
@ -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 {
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user