httpclient/http.go
func (d *dumpClient) doImp(req *http.Request, hidden bool, ctx context.Context) (*http.Response, error) {
	if req.URL.Scheme == "" {
		if d.isInsecure() {
			req.URL.Scheme = "http"
		} else {
			req.URL.Scheme = "https"
		}
	}

	//set user-agent if one is not provided.
	ua := req.Header.Get("User-Agent")
	if ua == "" {
		req.Header.Set("User-Agent", UA)
	}

	var reqBody []byte
	startedAt := time.Now()

	// prefer the X-Request-Id header as request token for logging, if present.
	id := req.Header.Get(requestIdHeader)
	if id == "" {
		id = ShortToken()
	}
	log.Info("started", "id", id, req.Method, req.URL.String())
	df := d.dumpFormat()
	hide := (df == NoDump) || (hidden && !df.IsVerbose())
	if !hide {
		startedAt = time.Now()
		reqBody = d.dumpRequest(req)
	}
	var resp *http.Response
	var err error
	if ctx == nil {
		resp, err = d.Client.Do(req)
	} else {
		resp, err = ctxhttpDo(ctx, d.getClientWithoutTimeout(), req)
	}
	if urlError, ok := err.(*url.Error); ok {
		if urlError.Err.Error() == noRedirectError {
			err = nil
		}
	}
	if err != nil {
		return nil, err
	}
	if !hide {
		d.dumpResponse(resp, req, reqBody)
	}
	log.Info("completed", "id", id, "status", resp.Status, "time", time.Since(startedAt).String())

	return resp, nil
}
func (d *dumpClient) doImp(req *http.Request, hidden bool, ctx context.Context) (*http.Response, error) {
	if req.URL.Scheme == "" {
		if d.isInsecure() {
			req.URL.Scheme = "http"
		} else {
			req.URL.Scheme = "https"
		}
	}

	//set user-agent if one is not provided.
	ua := req.Header.Get("User-Agent")
	if ua == "" {
		req.Header.Set("User-Agent", UA)
	}

	var reqBody []byte
	startedAt := time.Now()

	// prefer the X-Request-Id header as request token for logging, if present.
	id := req.Header.Get(requestIdHeader)
	if id == "" {
		id = ShortToken()
	}
	log.Info("started", "id", id, req.Method, req.URL.String())
	df := d.dumpFormat()
	hide := (df == NoDump) || (hidden && !df.IsVerbose())
	if !hide {
		startedAt = time.Now()
		reqBody = d.dumpRequest(req)
	}
	var resp *http.Response
	var err error
	if ctx == nil {
		resp, err = d.Client.Do(req)
	} else {
		resp, err = ctxhttpDo(ctx, d.getClientWithoutTimeout(), req)
	}
	if urlError, ok := err.(*url.Error); ok {
		if urlError.Err.Error() == noRedirectError {
			err = nil
		}
	}
	if err != nil {
		return nil, err
	}
	if !hide {
		d.dumpResponse(resp, req, reqBody)
	}
	log.Info("completed", "id", id, "status", resp.Status, "time", time.Since(startedAt).String())

	return resp, nil
}
// doImp actually performs the HTTP request logging according to the various settings.