MCPcopy
hub / github.com/cli/cli / HttpClientFunc

Function HttpClientFunc

pkg/cmd/factory/default.go:188–209  ·  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

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