diff --git a/http/round_tripper.go b/http/round_tripper.go index 4630f26..6e8f739 100644 --- a/http/round_tripper.go +++ b/http/round_tripper.go @@ -44,3 +44,14 @@ func (f *FollowRedirect) RoundTrip(req *stdhttp.Request) (*stdhttp.Response, err } return res, nil } + +type BasicAuthRoundTripper struct { + u, p string + + next stdhttp.RoundTripper +} + +func (bart *BasicAuthRoundTripper) RoundTrip(req *stdhttp.Request) (*stdhttp.Response, error) { + req.SetBasicAuth(bart.u, bart.p) + return bart.next.RoundTrip(req) +}