func NewRequest(client HTTPClient, verb string, baseURL *url.URL, versionedAPIPath string, content ContentConfig, serializers Serializers, backoff BackoffManager, throttle flowcontrol.RateLimiter) *Request {
	if backoff == nil {
		glog.V(2).Infof("Not implementing request backoff strategy.")
		backoff = &NoBackoff{}
	}
	pathPrefix := "/"
	if baseURL != nil {
		pathPrefix = path.Join(pathPrefix, baseURL.Path)
	}
	r := &Request{
		client:      client,
		verb:        verb,
		baseURL:     baseURL,
		pathPrefix:  path.Join(pathPrefix, versionedAPIPath),
		content:     content,
		serializers: serializers,
		backoffMgr:  backoff,
		throttle:    throttle,
	}
	switch {
	case len(content.AcceptContentTypes) > 0:
		r.SetHeader("Accept", content.AcceptContentTypes)
	case len(content.ContentType) > 0:
		r.SetHeader("Accept", content.ContentType+", */*")
	}
	return r
}
NewRequest creates a new request helper object for accessing runtime.Objects on a server.
package rest
import (
	"bytes"
	"encoding/hex"
	"fmt"
	"io"
	"io/ioutil"
	"mime"
	"net/http"
	"net/url"
	"path"
	"reflect"
	"strconv"
	"strings"
	"time"
	"github.com/golang/glog"
	"k8s.io/client-go/pkg/api/errors"
	"k8s.io/client-go/pkg/api/unversioned"
	"k8s.io/client-go/pkg/api/v1"
	pathvalidation "k8s.io/client-go/pkg/api/validation/path"
	"k8s.io/client-go/pkg/fields"
	"k8s.io/client-go/pkg/labels"
	"k8s.io/client-go/pkg/runtime"
	"k8s.io/client-go/pkg/runtime/serializer/streaming"
	"k8s.io/client-go/pkg/util/flowcontrol"
	"k8s.io/client-go/pkg/util/net"
	"k8s.io/client-go/pkg/util/sets"
	"k8s.io/client-go/pkg/watch"
	"k8s.io/client-go/pkg/watch/versioned"
	"k8s.io/client-go/tools/metrics"
)
var (
	specialParams = sets.NewString("timeout")
	longThrottleLatency = 50 * time.Millisecond
)
type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}
type ResponseWrapper interface {
	DoRaw() ([]byte, error)
	Stream() (io.ReadCloser, error)
}
type RequestConstructionError struct {
	Err error
}
func (r *RequestConstructionError) Error() string {
	return fmt.Sprintf("request construction error: '%v'", r.Err)
}
type Request struct {
	client HTTPClient
	verb   string
	baseURL     *url.URL
	content     ContentConfig
	serializers Serializers
	pathPrefix string
	subpath    string
	params     url.Values
	headers    http.Header
	namespace    string
	namespaceSet bool
	resource     string
	resourceName string
	subresource  string
	selector     labels.Selector
	timeout      time.Duration
	err  error
	body io.Reader
	req  *http.Request
	resp *http.Response
	backoffMgr BackoffManager
	throttle   flowcontrol.RateLimiter
}