MCPcopy Create free account
hub / github.com/cli/cli / HttpClientFunc

Function HttpClientFunc

pkg/cmd/factory/default.go:189–210  ·  view source on GitHub ↗
(cfgFunc func() (gh.Config, error), ios *iostreams.IOStreams, appVersion string, invokingAgent string, telemetryDisabler ghtelemetry.Disabler)

Source from the content-addressed store, hash-verified

187}
188
189func HttpClientFunc(cfgFunc func() (gh.Config, error), ios *iostreams.IOStreams, appVersion string, invokingAgent string, telemetryDisabler ghtelemetry.Disabler) func() (*http.Client, error) {
190 return func() (*http.Client, error) {
191 cfg, err := cfgFunc()
192 if err != nil {
193 return nil, err
194 }
195 opts := api.HTTPClientOptions{
196 Config: cfg.Authentication(),
197 Log: ios.ErrOut,
198 LogColorize: ios.ColorEnabled(),
199 AppVersion: appVersion,
200 InvokingAgent: invokingAgent,
201 TelemetryDisabler: telemetryDisabler,
202 }
203 client, err := api.NewHTTPClient(opts)
204 if err != nil {
205 return nil, err
206 }
207 client.Transport = api.ExtractHeader("X-GitHub-SSO", &ssoHeader)(client.Transport)
208 return client, nil
209 }
210}
211
212func plainHttpClientFunc(ios *iostreams.IOStreams, appVersion string, invokingAgent string, telemetryDisabler ghtelemetry.Disabler) func() (*http.Client, error) {
213 return func() (*http.Client, error) {

Callers 6

TestVerifyIntegrationFunction · 0.92
TestSSOURLFunction · 0.85
NewFunction · 0.85

Calls 4

NewHTTPClientFunction · 0.92
ExtractHeaderFunction · 0.92
ColorEnabledMethod · 0.80
AuthenticationMethod · 0.65