diff --git a/jenkins.go b/jenkins.go index dcba564c..5d2a6476 100644 --- a/jenkins.go +++ b/jenkins.go @@ -61,7 +61,7 @@ func (j *Jenkins) Init(ctx context.Context) (*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.") }