func (c *caller) prepareClient(resource, resourceID string) (*http.Client, string, error) {
	// TODO Mue 2016-10-28 Add more algorithms than just random selection.
	srv := c.srvs[rand.Intn(len(c.srvs))]
	client := &http.Client{}
	if srv.Transport != nil {
		client.Transport = srv.Transport
	}
	u, err := url.Parse(srv.URL)
	if err != nil {
		return nil, "", errors.Annotate(err, ErrCannotPrepareRequest, errorMessages)
	}
	upath := strings.Trim(u.Path, "/")
	path := []string{upath, c.domain, resource}
	if resourceID != "" {
		path = append(path, resourceID)
	}
	u.Path = strings.Join(path, "/")
	return client, u.String(), nil
}
// prepareClient prepares the client and the URL for the call.
prepareClient prepares the client and the URL for the call.
// prepareClient prepares the client and the URL for the call .
func (c *caller) prepareClient(resource, resourceID string) (*http.Client, string, error) {
	srv := c.srvs[rand.Intn(len(c.srvs))]
	client := &http.Client{}
	if srv.Transport != nil {
		client.Transport = srv.Transport
	}
	u, err := url.Parse(srv.URL)
	if err != nil {
		return nil, "", errors.Annotate(err, ErrCannotPrepareRequest, errorMessages)
	}
	upath := strings.Trim(u.Path, "/")
	path := []string{upath, c.domain, resource}
	if resourceID != "" {
		path = append(path, resourceID)
	}
	u.Path = strings.Join(path, "/")
	return client, u.String(), nil
}
func ( c * caller ) prepareClient ( resource , resourceID string ) ( * http . Client , string , error ) { srv := c . srvs [ rand . Intn ( len ( c . srvs ) ) ] client := & http . Client { } if srv . Transport != nil { client . Transport = srv . Transport } u , err := url . Parse ( srv . URL ) if err != nil { return nil , " " , errors . Annotate ( err , ErrCannotPrepareRequest , errorMessages ) } upath := strings . Trim ( u . Path , " " ) path := [ ] string { upath , c . domain , resource } if resourceID != " " { path = append ( path , resourceID ) } u . Path = strings . Join ( path , " " ) return client , u . String ( ) , nil }
prepareClient prepares the client and the URL for the call.
prepareClient prepares the client and the URL for the call .
// TODO Mue 2016-10-28 Add more algorithms than just random selection.