mirror of
https://github.com/restic/restic.git
synced 2024-08-22 04:13:23 +02:00
18 lines
494 B
Go
18 lines
494 B
Go
//go:build debug
|
|
// +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 {
|
|
eofRoundTripper := eofDetectRoundTripper{upstream}
|
|
if opts.isEnabled {
|
|
// only use loggingRoundTripper if the debug log is configured
|
|
return loggingRoundTripper{eofRoundTripper}
|
|
}
|
|
return eofRoundTripper
|
|
}
|