This commit is contained in:
Seth Vargo 2017-06-09 14:55:04 -04:00
parent ee1b5d5024
commit 89f16984f9
No known key found for this signature in database
GPG Key ID: C921994F9C27E0FF

View File

@ -152,18 +152,21 @@ func (s *HTTPServer) HealthServiceNodes(resp http.ResponseWriter, req *http.Requ
val := params.Get(api.HealthPassing)
// Backwards-compat to allow users to specify ?passing without a value. This
// should be removed in Consul 0.10.
var filter bool
if val == "" {
out.Nodes = filterNonPassing(out.Nodes)
filter = true
} else {
filter, err := strconv.ParseBool(val)
var err error
filter, err = strconv.ParseBool(val)
if err != nil {
resp.WriteHeader(400)
fmt.Fprint(resp, "Invalid value for ?passing")
return nil, nil
}
if filter {
out.Nodes = filterNonPassing(out.Nodes)
}
}
if filter {
out.Nodes = filterNonPassing(out.Nodes)
}
}