handle html response on expired cookies (require X-Ausername header to always be present)

This commit is contained in:
Cory Bennett
2017-09-03 23:28:17 -07:00
parent 7ab6c22751
commit 21920c5888
+2 -1
View File
@@ -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)