func (r *Response) Bytes() []byte {
	if r.Error != nil {
		return nil
	}
	r.populateResponseByteBuffer()
	if r.buffer.Len() == 0 {
		return nil
	}
	return r.buffer.Bytes()
}
Bytes returns the response as a byte array.
package gentleman
import (
	"bytes"
	"encoding/json"
	"encoding/xml"
	"io"
	"io/ioutil"
	"net/http"
	"os"
	"gopkg.in/h2non/gentleman.v2/context"
	"gopkg.in/h2non/gentleman.v2/utils"
)
type Response struct {
	Ok bool
	Error error
	ClientError bool
	ServerError bool
	StatusCode int
	Header http.Header
	Cookies []*http.Cookie
	RawResponse *http.Response
	RawRequest *http.Request
	Context *context.Context
	buffer *bytes.Buffer
}
func buildResponse(ctx *context.Context) (*Response, error) {
	resp := ctx.Response
	statusRange := int(resp.StatusCode / 100)
	res := &Response{
		Ok:          statusRange >= 2 && statusRange <= 3,
		Error:       ctx.Error,
		ClientError: statusRange == 4,
		ServerError: statusRange == 5,
		Context:     ctx,
		RawResponse: resp,
		RawRequest:  ctx.Request,
		StatusCode:  resp.StatusCode,
		Header:      resp.Header,
		Cookies:     resp.Cookies(),
		buffer:      bytes.NewBuffer([]byte{}),
	}
	return res, res.Error
}
func (r *Response) Read(p []byte) (n int, err error) {
	if r.Error != nil {
		return -1, r.Error
	}
	return r.RawResponse.Body.Read(p)
}
func (r *Response) Close() error {
	io.Copy(ioutil.Discard, r.RawResponse.Body)
	if r.Error != nil {
		return r.Error
	}
	return r.RawResponse.Body.Close()
}
func (r *Response) SaveToFile(fileName string) error {
	if r.Error != nil {
		return r.Error
	}
	fd, err := os.Create(fileName)
	if err != nil {
		return err
	}
	defer r.Close()  
	defer fd.Close()
	_, err = io.Copy(fd, r.getInternalReader())
	if err != nil && err != io.EOF {
		return err
	}
	return nil
}
func (r *Response) JSON(userStruct interface{}) error {
	if r.Error != nil {
		return r.Error
	}
	jsonDecoder := json.NewDecoder(r.getInternalReader())
	defer r.Close()
	err := jsonDecoder.Decode(&userStruct)
	if err != nil && err != io.EOF {
		return err
	}
	return nil
}
func (r *Response) XML(userStruct interface{}, charsetReader utils.XMLCharDecoder) error {
	if r.Error != nil {
		return r.Error
	}
	xmlDecoder := xml.NewDecoder(r.getInternalReader())
	if charsetReader != nil {
		xmlDecoder.CharsetReader = charsetReader
	}
	defer r.Close()
	if err := xmlDecoder.Decode(&userStruct); err != nil && err != io.EOF {
		return err
	}
	return nil
}