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

cmd/ofx: Allow setting User-Agent header from command-line

This commit is contained in:
Aaron Lindsay 2021-03-16 15:24:36 -04:00
parent 2641443ebe
commit e76c697cad
2 changed files with 3 additions and 0 deletions

View File

@ -24,6 +24,7 @@ var serverURL, username, password, org, fid, appID, appVer, ofxVersion, clientUI
var noIndentRequests bool var noIndentRequests bool
var carriageReturn bool var carriageReturn bool
var dryrun bool var dryrun bool
var userAgent string
func defineServerFlags(f *flag.FlagSet) { func defineServerFlags(f *flag.FlagSet) {
f.StringVar(&serverURL, "url", "", "Financial institution's OFX Server URL (see ofxhome.com if you don't know it)") f.StringVar(&serverURL, "url", "", "Financial institution's OFX Server URL (see ofxhome.com if you don't know it)")
@ -37,6 +38,7 @@ func defineServerFlags(f *flag.FlagSet) {
f.StringVar(&clientUID, "clientuid", "", "Client UID (only required by a few FIs, like Chase)") f.StringVar(&clientUID, "clientuid", "", "Client UID (only required by a few FIs, like Chase)")
f.BoolVar(&noIndentRequests, "noindent", false, "Don't indent OFX requests") f.BoolVar(&noIndentRequests, "noindent", false, "Don't indent OFX requests")
f.BoolVar(&carriageReturn, "carriagereturn", false, "Use carriage return as line separator") f.BoolVar(&carriageReturn, "carriagereturn", false, "Use carriage return as line separator")
f.StringVar(&userAgent, "useragent", "", "Use string as User-Agent header when sending request")
f.BoolVar(&dryrun, "dryrun", false, "Don't send request - print content of request instead") f.BoolVar(&dryrun, "dryrun", false, "Don't send request - print content of request instead")
} }

View File

@ -19,6 +19,7 @@ func newRequest() (ofxgo.Client, *ofxgo.Request) {
SpecVersion: ver, SpecVersion: ver,
NoIndent: noIndentRequests, NoIndent: noIndentRequests,
CarriageReturn: carriageReturn, CarriageReturn: carriageReturn,
UserAgent: userAgent,
}) })
var query ofxgo.Request var query ofxgo.Request