From 21920c58885c724edbdc5a9ba1ebe933a363b981 Mon Sep 17 00:00:00 2001 From: Cory Bennett Date: Sun, 3 Sep 2017 23:28:17 -0700 Subject: [PATCH] handle html response on expired cookies (require X-Ausername header to always be present) --- cmd/jira/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/jira/main.go b/cmd/jira/main.go index 25930c5..dc64fb0 100644 --- a/cmd/jira/main.go +++ b/cmd/jira/main.go @@ -94,7 +94,8 @@ func main() { o := oreo.New().WithCookieFile(filepath.Join(jiracli.Homedir(), fig.ConfigDir, "cookies.js")) o = o.WithPostCallback( func(req *http.Request, resp *http.Response) (*http.Response, error) { - if resp.Header.Get("X-Ausername") == "anonymous" { + authUser := resp.Header.Get("X-Ausername") + if authUser == "" || authUser == "anonymous" { // we are not logged in, so force login now by running the "login" command app.Parse([]string{"login"}) return o.Do(req)