2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-21 02:19:04 +00:00
restic/internal/debug/round_tripper_debug.go

18 lines
494 B
Go
Raw Normal View History

2022-03-28 20:23:47 +00:00
//go:build debug
2017-05-01 13:31:57 +00:00
// +build debug
package debug
import "net/http"
2017-05-01 13:31:57 +00:00
// 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
2017-05-01 13:31:57 +00:00
}