func (l *DumpRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
	var redactor *redact.PatternRedactor

	// check if the content redaction is enabled
	if !l.DumpNoRedact {
		redactor = redact.Ctx(req.Context())
	}

	// fast path if logging is disabled
	if !l.AnyEnabled() {
		return l.Transport().RoundTrip(req)
	}

	if l.ContainsBlacklistedPrefix(req.URL, l.BlacklistAnyDumpPrefixes) {
		return l.Transport().RoundTrip(req)
	}

	dumpBody := !l.ContainsBlacklistedPrefix(req.URL, l.BlacklistBodyDumpPrefixes) && l.DumpBody // move below !l.AnyEnabled to not clutter execution if everything is disabled

	dl := log.Ctx(req.Context()).Debug()

	// request logging
	if l.DumpRequest || l.DumpRequestHEX {
		reqDump, err := httputil.DumpRequest(req, dumpBody)
		if err != nil {
			reqDump = []byte(err.Error())
		}

		// in case a redactor is present, redact the content before logging
		if redactor != nil {
			reqDump = []byte(redactor.Mask(string(reqDump)))
		}

		if l.DumpRequest {
			dl = dl.Bytes(DumpRoundTripperOptionRequest, reqDump)
		}
		if l.DumpRequestHEX {
			dl = dl.Str(DumpRoundTripperOptionRequestHEX, hex.EncodeToString(reqDump))
		}
	}

	resp, err := l.Transport().RoundTrip(req)
	if err != nil {
		return resp, err
	}

	// response logging
	if l.DumpResponse || l.DumpResponseHEX {
		respDump, err := httputil.DumpResponse(resp, dumpBody)
		if err != nil {
			respDump = []byte(err.Error())
		}

		// in case a redactor is present, redact the content before logging
		if redactor != nil {
			respDump = []byte(redactor.Mask(string(respDump)))
		}
		if l.DumpResponse {
			dl = dl.Bytes(DumpRoundTripperOptionResponse, respDump)
		}
		if l.DumpResponseHEX {
			dl = dl.Str(DumpRoundTripperOptionResponseHEX, hex.EncodeToString(respDump))
		}
	}

	// emit log
	dl.Msg("HTTP Transport Dump")

	return resp, err
}
// RoundTrip executes a single HTTP transaction via Transport()
RoundTrip executes a single HTTP transaction via Transport()
// RoundTrip executes a single HTTP transaction via Transport ()
func (l *DumpRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
	var redactor *redact.PatternRedactor
	if !l.DumpNoRedact {
		redactor = redact.Ctx(req.Context())
	}
	if !l.AnyEnabled() {
		return l.Transport().RoundTrip(req)
	}
	if l.ContainsBlacklistedPrefix(req.URL, l.BlacklistAnyDumpPrefixes) {
		return l.Transport().RoundTrip(req)
	}
	dumpBody := !l.ContainsBlacklistedPrefix(req.URL, l.BlacklistBodyDumpPrefixes) && l.DumpBody 
	dl := log.Ctx(req.Context()).Debug()
	if l.DumpRequest || l.DumpRequestHEX {
		reqDump, err := httputil.DumpRequest(req, dumpBody)
		if err != nil {
			reqDump = []byte(err.Error())
		}
		if redactor != nil {
			reqDump = []byte(redactor.Mask(string(reqDump)))
		}
		if l.DumpRequest {
			dl = dl.Bytes(DumpRoundTripperOptionRequest, reqDump)
		}
		if l.DumpRequestHEX {
			dl = dl.Str(DumpRoundTripperOptionRequestHEX, hex.EncodeToString(reqDump))
		}
	}
	resp, err := l.Transport().RoundTrip(req)
	if err != nil {
		return resp, err
	}
	if l.DumpResponse || l.DumpResponseHEX {
		respDump, err := httputil.DumpResponse(resp, dumpBody)
		if err != nil {
			respDump = []byte(err.Error())
		}
		if redactor != nil {
			respDump = []byte(redactor.Mask(string(respDump)))
		}
		if l.DumpResponse {
			dl = dl.Bytes(DumpRoundTripperOptionResponse, respDump)
		}
		if l.DumpResponseHEX {
			dl = dl.Str(DumpRoundTripperOptionResponseHEX, hex.EncodeToString(respDump))
		}
	}
	dl.Msg("HTTP Transport Dump")
	return resp, err
}
func ( l * DumpRoundTripper ) RoundTrip ( req * http . Request ) ( * http . Response , error ) { var redactor * redact . PatternRedactor if ! l . DumpNoRedact { redactor = redact . Ctx ( req . Context ( ) ) } if ! l . AnyEnabled ( ) { return l . Transport ( ) . RoundTrip ( req ) } if l . ContainsBlacklistedPrefix ( req . URL , l . BlacklistAnyDumpPrefixes ) { return l . Transport ( ) . RoundTrip ( req ) } dumpBody := ! l . ContainsBlacklistedPrefix ( req . URL , l . BlacklistBodyDumpPrefixes ) && l . DumpBody dl := log . Ctx ( req . Context ( ) ) . Debug ( ) if l . DumpRequest || l . DumpRequestHEX { reqDump , err := httputil . DumpRequest ( req , dumpBody ) if err != nil { reqDump = [ ] byte ( err . Error ( ) ) } if redactor != nil { reqDump = [ ] byte ( redactor . Mask ( string ( reqDump ) ) ) } if l . DumpRequest { dl = dl . Bytes ( DumpRoundTripperOptionRequest , reqDump ) } if l . DumpRequestHEX { dl = dl . Str ( DumpRoundTripperOptionRequestHEX , hex . EncodeToString ( reqDump ) ) } } resp , err := l . Transport ( ) . RoundTrip ( req ) if err != nil { return resp , err } if l . DumpResponse || l . DumpResponseHEX { respDump , err := httputil . DumpResponse ( resp , dumpBody ) if err != nil { respDump = [ ] byte ( err . Error ( ) ) } if redactor != nil { respDump = [ ] byte ( redactor . Mask ( string ( respDump ) ) ) } if l . DumpResponse { dl = dl . Bytes ( DumpRoundTripperOptionResponse , respDump ) } if l . DumpResponseHEX { dl = dl . Str ( DumpRoundTripperOptionResponseHEX , hex . EncodeToString ( respDump ) ) } } dl . Msg ( " " ) return resp , err }
RoundTrip executes a single HTTP transaction via Transport()
RoundTrip executes a single HTTP transaction via Transport ()
// check if the content redaction is enabled // fast path if logging is disabled // move below !l.AnyEnabled to not clutter execution if everything is disabled // request logging // in case a redactor is present, redact the content before logging // response logging // in case a redactor is present, redact the content before logging // emit log