in spinnaker/config.go [27:52]
func (s Spinnaker) Get(app string) (c *chaosmonkey.AppConfig, err error) {
// avoid expanding the response to avoid unneeded load
url := s.appURL(app) + "?expand=false"
resp, err := s.client.Get(url)
if err != nil {
return nil, errors.Wrapf(err, "http get failed at %s", url)
}
defer func() {
if cerr := resp.Body.Close(); cerr != nil && err == nil {
err = errors.Wrapf(err, "body close failed at %s", url)
}
}()
// should return a 200
if resp.StatusCode != http.StatusOK {
return nil, errors.Errorf("unexpected response code (%d) from %s", resp.StatusCode, url)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, errors.Wrapf(err, "body read failed at %s", url)
}
return fromJSON(body)
}