code: func retryHTTP(c context.Context, u url.URL, method, body string) ([]byte, error) {
  	client := http.Client{}
  
  	gen := func() retry.Iterator {
  		return &retry.Limited{
  			Delay:   2 * time.Second,
  			Retries: 20,
  		}
  	}
  
  	output := []byte(nil)
  	err := retry.Retry(c, gen, func() error {
  		req := http.Request{
  			Method: method,
  			URL:    &u,
  			Header: http.Header{},
  		}
  		if len(body) > 0 {
  			req.Body = ioutil.NopCloser(bytes.NewBuffer([]byte(body)))
  			req.ContentLength = int64(len(body))
  			req.Header.Add("Content-Type", "application/json")
  		}
  
  		resp, err := client.Do(&req)
  		if err != nil {
  			return err
  		}
  		if resp.Body != nil {
  			defer resp.Body.Close()
  			output, err = ioutil.ReadAll(resp.Body)
  			if err != nil {
  				return err
  			}
  		}
  
  		switch resp.StatusCode {
  		case http.StatusOK, http.StatusNoContent:
  			return nil
  
  		default:
  			return fmt.Errorf("unsuccessful status code (%d): %s", resp.StatusCode, resp.Status)
  		}
  	}, func(err error, d time.Duration) {
  		log.Fields{
  			log.ErrorKey: err,
  			"url":        u.String(),
  			"delay":      d,
  		}.Infof(c, "Service is not up yet; retrying.")
  	})
  	if err != nil {
  		return nil, err
  	}
  
  	log.Fields{
  		"url": u.String(),
  	}.Infof(c, "Service is alive!")
  	return output, nil
  }
docs: // retryHTTP executes an HTTP call to the specified URL, retrying if it fails.
  //
  // It will return an error if no successful HTTP results were returned.
  // Otherwise, it will return the body of the successful HTTP response.