code: func (c *InternalClient) executeRequest(req *http.Request) (*http.Response, error) {
  	tracing.GlobalTracer.InjectHTTPHeaders(req)
  	resp, err := c.httpClient.Do(req)
  	if err != nil {
  		if resp != nil {
  			resp.Body.Close()
  		}
  		return nil, errors.Wrap(err, "getting response")
  	}
  	if resp.StatusCode < 200 || resp.StatusCode >= 300 {
  		defer resp.Body.Close()
  		buf, err := ioutil.ReadAll(resp.Body)
  		if err != nil {
  			return resp, errors.Wrapf(err, "bad status '%s' and err reading body", resp.Status)
  		}
  		var msg string
  		// try to decode a JSON response
  		var sr successResponse
  		if err = json.Unmarshal(buf, &sr); err == nil {
  			msg = sr.Error.Error()
  		} else {
  			msg = string(buf)
  		}
  		return resp, errors.Errorf("server error %s: '%s'", resp.Status, msg)
  	}
  	return resp, nil
  }
docs: // executeRequest executes the given request and checks the Response. For
  // responses with non-2XX status, the body is read and closed, and an error is
  // returned. If the error is nil, the caller must ensure that the response body
  // is closed.