Add basic auth round tripper to http

otelq
William Perron 1 year ago
parent 83e720e5a2
commit a06f28f122
No known key found for this signature in database
GPG Key ID: D1815C43C9BA3DE1

@ -44,3 +44,14 @@ func (f *FollowRedirect) RoundTrip(req *stdhttp.Request) (*stdhttp.Response, err
} }
return res, nil 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)
}

Loading…
Cancel
Save