rpc.go
func (r rpc) executeRequest(req *http.Request) ([]byte, error) {
	resp, err := r.auth.getClient().Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	buf := new(bytes.Buffer)
	buf.ReadFrom(resp.Body)
	bytes := buf.Bytes()
	if resp.StatusCode != 200 {
		if len(bytes) == 0 { // Log response body for debugging purposes
			log.Printf("Response body was empty")
		} else {
			log.Printf("Response body:\n\t%s\n", bytes)
		}
		return nil, fmt.Errorf("%s %s failed. Response code was %s", req.Method, req.URL, resp.Status)
	}
	return bytes, nil
}
func (r rpc) executeRequest(req *http.Request) ([]byte, error) {
	resp, err := r.auth.getClient().Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	buf := new(bytes.Buffer)
	buf.ReadFrom(resp.Body)
	bytes := buf.Bytes()
	if resp.StatusCode != 200 {
		if len(bytes) == 0 { // Log response body for debugging purposes
			log.Printf("Response body was empty")
		} else {
			log.Printf("Response body:\n\t%s\n", bytes)
		}
		return nil, fmt.Errorf("%s %s failed. Response code was %s", req.Method, req.URL, resp.Status)
	}
	return bytes, nil
}
func ( r rpc ) executeRequest ( req * http . Request ) ( [ ] byte , error ) { resp , err := r . auth . getClient ( ) . Do ( req ) if err != nil { return nil , err } defer resp . Body . Close ( ) buf := new ( bytes . Buffer ) buf . ReadFrom ( resp . Body ) bytes := buf . Bytes ( ) if resp . StatusCode != 200 { if len ( bytes ) == 0 { // Log response body for debugging purposes log . Printf ( " " ) } else { log . Printf ( " \n \t \n " , bytes ) } return nil , fmt . Errorf ( " " , req . Method , req . URL , resp . Status ) } return bytes , nil }
// executeRequest takes a prepared http.Request and returns the body of the response
// If the response is not of HTTP Code 200, an error is returned
executeRequest takes a prepared http . Request and returns the body of the response If the response is not of HTTP Code 200 an error is returned