2022-03-28 22:23:47 +02:00
|
|
|
//go:build !debug
|
2017-05-01 15:31:57 +02:00
|
|
|
// +build !debug
|
|
|
|
|
|
|
|
package debug
|
|
|
|
|
|
|
|
import "net/http"
|
|
|
|
|
|
|
|
// RoundTripper returns a new http.RoundTripper which logs all requests (if
|
|
|
|
// debug is enabled). When debug is not enabled, upstream is returned.
|
|
|
|
func RoundTripper(upstream http.RoundTripper) http.RoundTripper {
|
2022-07-16 21:41:37 +02:00
|
|
|
if opts.isEnabled {
|
|
|
|
// only use loggingRoundTripper if the debug log is configured
|
|
|
|
return loggingRoundTripper{eofDetectRoundTripper{upstream}}
|
|
|
|
}
|
2017-05-01 15:31:57 +02:00
|
|
|
return upstream
|
|
|
|
}
|