(req *http.Request)
| 627 | } |
| 628 | |
| 629 | func (rt *authorizationCredentialsFileRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { |
| 630 | if len(req.Header.Get("Authorization")) == 0 { |
| 631 | b, err := os.ReadFile(rt.authCredentialsFile) |
| 632 | if err != nil { |
| 633 | return nil, fmt.Errorf("unable to read authorization credentials file %s: %w", rt.authCredentialsFile, err) |
| 634 | } |
| 635 | authCredentials := strings.TrimSpace(string(b)) |
| 636 | |
| 637 | req = cloneRequest(req) |
| 638 | req.Header.Set("Authorization", fmt.Sprintf("%s %s", rt.authType, authCredentials)) |
| 639 | } |
| 640 | |
| 641 | return rt.rt.RoundTrip(req) |
| 642 | } |
| 643 | |
| 644 | func (rt *authorizationCredentialsFileRoundTripper) CloseIdleConnections() { |
| 645 | if ci, ok := rt.rt.(closeIdler); ok { |
nothing calls this directly
no test coverage detected