// ReadResponseBody is the lower-level method of client to read the result of a `Client#Do`, it closes the body stream.
//
// See `ReadJSON` too.
ReadResponseBody is the lower-level method of client to read the result of a `Client#Do`, it closes the body stream.

See `ReadJSON` too.
// ReadResponseBody is the lower - level method of client to read the result of a ` Client#Do ` it closes the body stream . // // See ` ReadJSON ` too .
func (c *Client) ReadResponseBody(resp *http.Response) ([]byte, error) {
	reader, err := c.acquireResponseBodyStream(resp)
	if err != nil {
		return nil, err
	}
	b, err := ioutil.ReadAll(reader)
	if err = reader.Close(); err != nil {
		return nil, err
	}
	if c.Config.Debug {
		rawBodyString := string(b)
		if strings.Contains(resp.Header.Get(contentTypeHeaderKey), "text/html") {
			err = ErrUnknownResponse
		}
		golog.Debugf("Client#Do.resp:\n\tbody: %s\n\tstatus code: %d\n\terror: [%v]", rawBodyString, resp.StatusCode, err)
	}
	return b, err
}
func ( c * Client ) ReadResponseBody ( resp * http . Response ) ( [ ] byte , error ) { reader , err := c . acquireResponseBodyStream ( resp ) if err != nil { return nil , err } b , err := ioutil . ReadAll ( reader ) if err = reader . Close ( ) ; err != nil { return nil , err } if c . Config . Debug { rawBodyString := string ( b ) if strings . Contains ( resp . Header . Get ( contentTypeHeaderKey ) , " " ) { err = ErrUnknownResponse } golog . Debugf ( " \n \t \n \t \n \t " , rawBodyString , resp . StatusCode , err ) } return b , err }
ReadResponseBody is the lower-level method of client to read the result of a `Client#Do`, it closes the body stream.
ReadResponseBody is the lower - level method of client to read the result of a ` Client#Do ` it closes the body stream .
/*
			var body []byte

			if c.Progress != nil {
				var (
					total   = resp.ContentLength
					current int64
				)

				for {
					buf := make([]byte, bufN)
					readen, readErr := reader.Read(buf)
					// Callers should always process the n > 0 bytes returned before
					// considering the error err. Doing so correctly handles I/O errors
					// that happen after reading some bytes and also both of the
					// allowed EOF behaviors.
					if readen > 0 {
						current += int64(readen)
						body = append(body, buf[:readen]...)
						c.Progress(current, total) // call it every x ms or let the user decide?
					}
					if readErr != nil {
						if readErr == io.EOF {
							break
						}

						return nil, readErr
					}
				}
			} else {
				body, err = ioutil.ReadAll(reader)
		    }
	*/ // if len(b) == 0 || (len(b) == 2 && (b[0] == '[' && b[1] == ']') || (b[0] == '{' && b[1] == '}')) { // 	return nil, errEmptyResponse // } // If debug will print the full body through "rawBodyString", but the error here is the same content, // so no need to duplicate it. // The error should be minimal in this case in order to be resolved by callers: `lenses.ErrUnknownResponse`, same for !debug. // print both body and error, because both of them may be formated by the `readResponseBody`'s caller. // return the body.