From 3655c428bba9a74ca8e8bbac117b877582f97ac2 Mon Sep 17 00:00:00 2001 From: ziyuan Date: Wed, 8 Jul 2020 16:40:40 +0800 Subject: [PATCH] Jenkins.Init() should check Response.StatusCode #210 --- jenkins.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins.go b/jenkins.go index 1421c97f..d3da7eba 100644 --- a/jenkins.go +++ b/jenkins.go @@ -59,7 +59,7 @@ func (j *Jenkins) Init() (*Jenkins, error) { } j.Version = rsp.Header.Get("X-Jenkins") - if j.Raw == nil { + if j.Raw == nil || rsp.StatusCode != http.StatusOK { return nil, errors.New("Connection Failed, Please verify that the host and credentials are correct.") }