From e76c697cada204703aa99d8e58553ef3336f4975 Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Tue, 16 Mar 2021 15:24:36 -0400 Subject: [PATCH] cmd/ofx: Allow setting User-Agent header from command-line --- cmd/ofx/command.go | 2 ++ cmd/ofx/util.go | 1 + 2 files changed, 3 insertions(+) diff --git a/cmd/ofx/command.go b/cmd/ofx/command.go index 0f33b41..c983ddb 100644 --- a/cmd/ofx/command.go +++ b/cmd/ofx/command.go @@ -24,6 +24,7 @@ var serverURL, username, password, org, fid, appID, appVer, ofxVersion, clientUI var noIndentRequests bool var carriageReturn bool var dryrun bool +var userAgent string func defineServerFlags(f *flag.FlagSet) { 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.BoolVar(&noIndentRequests, "noindent", false, "Don't indent OFX requests") 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") } diff --git a/cmd/ofx/util.go b/cmd/ofx/util.go index abb5731..33f5a65 100644 --- a/cmd/ofx/util.go +++ b/cmd/ofx/util.go @@ -19,6 +19,7 @@ func newRequest() (ofxgo.Client, *ofxgo.Request) { SpecVersion: ver, NoIndent: noIndentRequests, CarriageReturn: carriageReturn, + UserAgent: userAgent, }) var query ofxgo.Request