// Do executes an HTTP request and returns the response body.
// Any errors or non-200 status code result in an error.
Do executes an HTTP request and returns the response body.
Any errors or non-200 status code result in an error.
// Do executes an HTTP request and returns the response body . // Any errors or non - 200 status code result in an error .
func Do(req *http.Request) ([]byte, error) {
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("StatusCode: %d, Body: %s", resp.StatusCode, body)
	}
	return body, nil
}
func Do ( req * http . Request ) ( [ ] byte , error ) { resp , err := http . DefaultClient . Do ( req ) if err != nil { return nil , err } defer resp . Body . Close ( ) body , err := ioutil . ReadAll ( resp . Body ) if err != nil { return nil , err } if resp . StatusCode != http . StatusOK { return nil , fmt . Errorf ( " " , resp . StatusCode , body ) } return body , nil }
Do executes an HTTP request and returns the response body.
Do executes an HTTP request and returns the response body .