NewFetcher creates a new scope fetcher with the given options.
(apiHost utils.APIHostResolver, opts FetcherOptions)
| 42 | |
| 43 | // NewFetcher creates a new scope fetcher with the given options. |
| 44 | func NewFetcher(apiHost utils.APIHostResolver, opts FetcherOptions) *Fetcher { |
| 45 | client := opts.HTTPClient |
| 46 | if client == nil { |
| 47 | client = &http.Client{Timeout: DefaultFetchTimeout} |
| 48 | } |
| 49 | |
| 50 | return &Fetcher{ |
| 51 | client: client, |
| 52 | apiHost: apiHost, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // FetchTokenScopes retrieves the OAuth scopes for a token by making an HTTP HEAD |
| 57 | // request to the GitHub API and parsing the X-OAuth-Scopes header. |
no outgoing calls