httpclient/http.go
func (d *dumpClient) dumpRequest(req *http.Request) []byte {
	df := d.dumpFormat()
	if df == NoDump {
		return nil
	}
	reqBody, err := dumpReqBody(req)
	if err != nil {
		log.Error("Failed to load request body for dump", "error", err.Error())
	}
	if df.IsDebug() {
		var buffer bytes.Buffer
		buffer.WriteString(req.Method + " " + req.URL.String() + "\n")
		d.writeHeaders(&buffer, req.Header)
		if reqBody != nil {
			buffer.WriteString("\n")
			buffer.Write(reqBody)
			buffer.WriteString("\n")
		}
		fmt.Fprint(OsStderr, buffer.String())
	} else if df.IsJSON() {
		return reqBody
	}
	return nil
}
func (d *dumpClient) dumpRequest(req *http.Request) []byte {
	df := d.dumpFormat()
	if df == NoDump {
		return nil
	}
	reqBody, err := dumpReqBody(req)
	if err != nil {
		log.Error("Failed to load request body for dump", "error", err.Error())
	}
	if df.IsDebug() {
		var buffer bytes.Buffer
		buffer.WriteString(req.Method + " " + req.URL.String() + "\n")
		d.writeHeaders(&buffer, req.Header)
		if reqBody != nil {
			buffer.WriteString("\n")
			buffer.Write(reqBody)
			buffer.WriteString("\n")
		}
		fmt.Fprint(OsStderr, buffer.String())
	} else if df.IsJSON() {
		return reqBody
	}
	return nil
}
// Dump request if needed.
// Return request serialized as JSON if DumpFormat is JSON, nil otherwise.