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

Function plainHttpClientFunc

pkg/cmd/factory/default.go:245–262  ·  view source on GitHub ↗
(ios *iostreams.IOStreams, appVersion string, invokingAgent string, telemetryDisabler ghtelemetry.Disabler)

Source from the content-addressed store, hash-verified

243}
244
245func plainHttpClientFunc(ios *iostreams.IOStreams, appVersion string, invokingAgent string, telemetryDisabler ghtelemetry.Disabler) func() (*http.Client, error) {
246 return func() (*http.Client, error) {
247 opts := api.HTTPClientOptions{
248 Log: ios.ErrOut,
249 LogColorize: ios.ColorEnabled(),
250 AppVersion: appVersion,
251 InvokingAgent: invokingAgent,
252 // This is required to prevent automatic setting of auth and other headers.
253 SkipDefaultHeaders: true,
254 TelemetryDisabler: telemetryDisabler,
255 }
256 client, err := api.NewHTTPClient(opts)
257 if err != nil {
258 return nil, err
259 }
260 return client, nil
261 }
262}
263
264// configWithTokenRefresher returns a config accessor that injects the OAuth token refresher into the AuthConfig the
265// first time the configuration is resolved, so refreshable credentials can be renewed during ordinary commands. The

Callers 2

TestPlainHttpClientFunction · 0.85
NewFunction · 0.85

Calls 2

NewHTTPClientFunction · 0.92
ColorEnabledMethod · 0.80

Tested by 1

TestPlainHttpClientFunction · 0.68