mirror of
https://github.com/status-im/consul.git
synced 2025-02-02 00:46:43 +00:00
Set connect or ingress boolean after checking for query param
This commit is contained in:
parent
4837069fe0
commit
ca41f80493
@ -164,7 +164,7 @@ func (s *HTTPServer) HealthServiceNodes(resp http.ResponseWriter, req *http.Requ
|
|||||||
|
|
||||||
func (s *HTTPServer) healthServiceNodes(resp http.ResponseWriter, req *http.Request, connect bool) (interface{}, error) {
|
func (s *HTTPServer) healthServiceNodes(resp http.ResponseWriter, req *http.Request, connect bool) (interface{}, error) {
|
||||||
// Set default DC
|
// Set default DC
|
||||||
args := structs.ServiceSpecificRequest{Connect: connect}
|
args := structs.ServiceSpecificRequest{}
|
||||||
if err := s.parseEntMetaNoWildcard(req, &args.EnterpriseMeta); err != nil {
|
if err := s.parseEntMetaNoWildcard(req, &args.EnterpriseMeta); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -185,19 +185,19 @@ func (s *HTTPServer) healthServiceNodes(resp http.ResponseWriter, req *http.Requ
|
|||||||
prefix := "/v1/health/service/"
|
prefix := "/v1/health/service/"
|
||||||
if connect {
|
if connect {
|
||||||
prefix = "/v1/health/connect/"
|
prefix = "/v1/health/connect/"
|
||||||
}
|
|
||||||
|
|
||||||
// Check for ingress request only when requesting connect services
|
// Check for ingress request only when requesting connect services
|
||||||
if connect {
|
|
||||||
ingress, err := getBoolQueryParam(params, "ingress")
|
ingress, err := getBoolQueryParam(params, "ingress")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
resp.WriteHeader(http.StatusBadRequest)
|
resp.WriteHeader(http.StatusBadRequest)
|
||||||
fmt.Fprint(resp, "Invalid value for ?ingress")
|
fmt.Fprint(resp, "Invalid value for ?ingress")
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if ingress {
|
if ingress {
|
||||||
args.Connect = false
|
|
||||||
args.Ingress = true
|
args.Ingress = true
|
||||||
|
} else {
|
||||||
|
args.Connect = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user