mirror of
https://github.com/status-im/consul.git
synced 2025-01-22 11:40:06 +00:00
Simplify
This commit is contained in:
parent
ee1b5d5024
commit
89f16984f9
@ -152,18 +152,21 @@ func (s *HTTPServer) HealthServiceNodes(resp http.ResponseWriter, req *http.Requ
|
|||||||
val := params.Get(api.HealthPassing)
|
val := params.Get(api.HealthPassing)
|
||||||
// Backwards-compat to allow users to specify ?passing without a value. This
|
// Backwards-compat to allow users to specify ?passing without a value. This
|
||||||
// should be removed in Consul 0.10.
|
// should be removed in Consul 0.10.
|
||||||
|
var filter bool
|
||||||
if val == "" {
|
if val == "" {
|
||||||
out.Nodes = filterNonPassing(out.Nodes)
|
filter = true
|
||||||
} else {
|
} else {
|
||||||
filter, err := strconv.ParseBool(val)
|
var err error
|
||||||
|
filter, err = strconv.ParseBool(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.WriteHeader(400)
|
resp.WriteHeader(400)
|
||||||
fmt.Fprint(resp, "Invalid value for ?passing")
|
fmt.Fprint(resp, "Invalid value for ?passing")
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
if filter {
|
}
|
||||||
out.Nodes = filterNonPassing(out.Nodes)
|
|
||||||
}
|
if filter {
|
||||||
|
out.Nodes = filterNonPassing(out.Nodes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user