func()

in pkg/mesh/app.go [203:228]


func (kr *KRun) processHealthCheckResponse(res *http.Response, key string, val string) (bool, error) {
	if res == nil || res.StatusCode != 200 {
		return false, fmt.Errorf("Unable to check envoy for %s", key)
	}

	rawResponse, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return false, fmt.Errorf("Unable to check envoy for %s because of %s", key, err)
	}

	response := string(rawResponse)
	splits := strings.Split(response, ":")
	if len(splits) != 2 {
		return false, nil
	}

	// Check key
	if strings.TrimSpace(splits[0]) != key {
		return false, nil
	}
	// Check val
	if strings.TrimSpace(splits[1]) != val {
		return false, nil
	}
	return true, nil
}