MCPcopy Create free account
hub / github.com/prometheus/common / NewBasicAuthRoundTripper

Function NewBasicAuthRoundTripper

config/http_config.go:906–908  ·  view source on GitHub ↗

NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a request unless it has already been set.

(username, password SecretReader, rt http.RoundTripper)

Source from the content-addressed store, hash-verified

904// NewBasicAuthRoundTripper will apply a BASIC auth authorization header to a request unless it has
905// already been set.
906func NewBasicAuthRoundTripper(username, password SecretReader, rt http.RoundTripper) http.RoundTripper {
907 return &basicAuthRoundTripper{username, password, rt}
908}
909
910func (rt *basicAuthRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
911 if len(req.Header.Get("Authorization")) != 0 || isCrossHostRedirect(req) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected