func (t *RequestModifyingTransport) applyOverrides(req *http.Request) *http.Request {
	if method := strings.ToUpper(req.Method); method != "GET" && method != "HEAD" {
		return req
	}
	requestURI := req.URL.RequestURI()
	t.overridesMu.Lock()
	defer t.overridesMu.Unlock()
	cloned := false
	for requestURIRegexp, override := range t.overrides {
		if requestURIRegexp.MatchString(requestURI) {
			if !cloned {
				req = cloneRequest(req)
				cloned = true
			}
			for name, val := range override.setHeaders {
				req.Header[textproto.CanonicalMIMEHeaderKey(name)] = val
			}
			if override.runOnlyOnce {
				delete(t.overrides, requestURIRegexp)
			}
		}
	}
	return req
}
applyOverrides applies the transport's request overrides to req. If any
overrides apply, req is cloned and the overrides are applied to the clone.
package apiproxy
import (
	"net/http"
	"net/textproto"
	"regexp"
	"strings"
	"sync"
)
type RequestModifyingTransport struct {
	overrides   map[*regexp.Regexp]requestOverride
	overridesMu sync.Mutex
	Transport http.RoundTripper
}
func (t *RequestModifyingTransport) RoundTrip(req *http.Request) (resp *http.Response, err error) {
	req = t.applyOverrides(req)
	transport := t.Transport
	if transport == nil {
		transport = http.DefaultTransport
	}
	return transport.RoundTrip(req)
}
type requestOverride struct {
	setHeaders  http.Header
	runOnlyOnce bool
}
func (t *RequestModifyingTransport) Override(requestURI *regexp.Regexp, setHeaders http.Header, runOnlyOnce bool) {
	t.overridesMu.Lock()
	defer t.overridesMu.Unlock()
	if t.overrides == nil {
		t.overrides = make(map[*regexp.Regexp]requestOverride)
	}
	t.overrides[requestURI] = requestOverride{setHeaders, runOnlyOnce}
}
var NoCache = http.Header{"Cache-Control": []string{"no-cache"}}