HttpRequest injects provider credentials into the supplied HTTP request and executes it.
(ctx context.Context, auth *Auth, req *http.Request)
| 5802 | |
| 5803 | // HttpRequest injects provider credentials into the supplied HTTP request and executes it. |
| 5804 | func (m *Manager) HttpRequest(ctx context.Context, auth *Auth, req *http.Request) (*http.Response, error) { |
| 5805 | if m == nil { |
| 5806 | return nil, &Error{Code: "provider_not_found", Message: "manager is nil"} |
| 5807 | } |
| 5808 | if auth == nil { |
| 5809 | return nil, &Error{Code: "auth_not_found", Message: "auth is nil"} |
| 5810 | } |
| 5811 | if req == nil { |
| 5812 | return nil, &Error{Code: "invalid_request", Message: "http request is nil"} |
| 5813 | } |
| 5814 | providerKey := executorKeyFromAuth(auth) |
| 5815 | if providerKey == "" { |
| 5816 | return nil, &Error{Code: "provider_not_found", Message: "auth provider is empty"} |
| 5817 | } |
| 5818 | exec := m.executorFor(providerKey) |
| 5819 | if exec == nil { |
| 5820 | return nil, &Error{Code: "provider_not_found", Message: "executor not registered for provider: " + providerKey} |
| 5821 | } |
| 5822 | return exec.HttpRequest(ctx, auth, req) |
| 5823 | } |
no test coverage detected