func (c Client) sender() Sender {
	if c.Sender == nil {
		return http.DefaultClient
	}
	return c.Sender
}
sender returns the Sender to which to send requests.
package autorest
import (
	"bytes"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	"time"
)
const (
	DefaultPollingDelay = 60 * time.Second
	DefaultPollingDuration = 15 * time.Minute
)
const (
	requestFormat = `HTTP Request Begin ===================================================
%s
===================================================== HTTP Request End
`
	responseFormat = `HTTP Response Begin ===================================================
%s
===================================================== HTTP Response End
`
)
type Response struct {
	*http.Response `json:"-"`
}
type LoggingInspector struct {
	Logger *log.Logger
}
func (li LoggingInspector) WithInspection() PrepareDecorator {
	return func(p Preparer) Preparer {
		return PreparerFunc(func(r *http.Request) (*http.Request, error) {
			var body, b bytes.Buffer
			defer r.Body.Close()
			r.Body = ioutil.NopCloser(io.TeeReader(r.Body, &body))
			r.Write(&b)
			li.Logger.Printf(requestFormat, b.String())
			r.Body = ioutil.NopCloser(&body)
			return p.Prepare(r)
		})
	}
}
func (li LoggingInspector) ByInspecting() RespondDecorator {
	return func(r Responder) Responder {
		return ResponderFunc(func(resp *http.Response) error {
			var body, b bytes.Buffer
			defer resp.Body.Close()
			resp.Body = ioutil.NopCloser(io.TeeReader(resp.Body, &body))
			resp.Write(&b)
			li.Logger.Printf(responseFormat, b.String())
			resp.Body = ioutil.NopCloser(&body)
			return r.Respond(resp)
		})
	}
}
type Client struct {
	Authorizer        Authorizer
	Sender            Sender
	RequestInspector  PrepareDecorator
	ResponseInspector RespondDecorator
	PollingDelay time.Duration
	PollingDuration time.Duration
	UserAgent string
}
func NewClientWithUserAgent(ua string) Client {
	c := Client{PollingDelay: DefaultPollingDelay, PollingDuration: DefaultPollingDuration}
	c.UserAgent = ua
	return c
}
func (c Client) Do(r *http.Request) (*http.Response, error) {
	if r.UserAgent() == "" {
		r, _ = Prepare(r,
			WithUserAgent(c.UserAgent))
	}
	r, err := Prepare(r,
		c.WithInspection(),
		c.WithAuthorization())
	if err != nil {
		return nil, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed")
	}
	resp, err := c.sender().Do(r)
	Respond(resp,
		c.ByInspecting())
	return resp, err
}