提交 eb65f29a 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

ignore error caused by login request return a html

上级 17d627c8
......@@ -197,13 +197,17 @@ func PostStr(url string, params map[string]string) (msg string, ok bool) {
var bodyJson model.ZentaoResponse
jsonErr := json.Unmarshal(bodyStr, &bodyJson)
isLogin := strings.Index(url, "login") > -1
if jsonErr != nil {
if vari.Verbose {
if strings.Index(url, "login") == -1 { // ignore jsonErr caused by login request return a html
if isLogin && strings.Index(string(bodyStr), "location=") > -1 { // ignore login request return a html
ok = true
} else {
ok = false
if !isLogin && vari.Verbose {
logUtils.PrintToCmd(jsonErr.Error(), color.FgRed)
}
}
ok = false
return
}
......
......@@ -33,7 +33,7 @@ func (c LangType) String() string {
case TCL:
return "tcl"
case AUTOIT:
return "autoit"
return "autoit"
}
return "unknown"
}
......@@ -62,25 +62,25 @@ func (c ResultStatus) String() string {
return "UNKNOWN"
}
type RunMode int
//type RunMode int
const (
RunModeDir RunMode = iota
RunModeBatch
RunModeSuite
RunModeScript
)
//const (
// RunModeDir RunMode = iota
// RunModeBatch
// RunModeSuite
// RunModeScript
//)
func (c RunMode) String() string {
switch c {
case RunModeDir:
return "dir"
case RunModeBatch:
return "batch"
case RunModeSuite: // can be show with cui by select a suite file
return "suite"
case RunModeScript: // can be show with cui by select a script file
return "script"
}
return "unknown"
}
//func (c RunMode) String() string {
// switch c {
// case RunModeDir:
// return "dir"
// case RunModeBatch:
// return "batch"
// case RunModeSuite: // can be show with cui by select a suite file
// return "suite"
// case RunModeScript: // can be show with cui by select a script file
// return "script"
// }
// return "unknown"
//}
......@@ -3,7 +3,6 @@ package vari
import (
"github.com/awesome-gocui/gocui"
"github.com/easysoft/zentaoatf/src/model"
"github.com/easysoft/zentaoatf/src/utils/const"
)
var (
......@@ -11,7 +10,7 @@ var (
Cui *gocui.Gui
MainViewHeight int
RunMode constant.RunMode
//RunMode constant.RunMode
ZTFDir string
LogDir string
RunFromCui bool
......@@ -42,4 +41,9 @@ var (
Verbose bool
Interpreter string
// server
RunMode string
WorkDir string
Port int
)
......@@ -70,6 +70,9 @@ func main() {
flagSet.BoolVar(&noNeedConfirm, "y", false, "")
flagSet.BoolVar(&vari.Verbose, "verbose", false, "")
flagSet.IntVar(&vari.Port, "P", 8848, "")
flagSet.IntVar(&vari.Port, "port", 8848, "")
var placeholder string
flagSet.StringVar(&placeholder, "h", "", "")
flagSet.StringVar(&placeholder, "r", "", "")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册