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

Function plainHttpClientFunc

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

Source from the content-addressed store, hash-verified

257}
258
259func plainHttpClientFunc(ios *iostreams.IOStreams, appVersion string, invokingAgent string, telemetryDisabler ghtelemetry.Disabler) func() (*http.Client, error) {
260 return func() (*http.Client, error) {
261 opts := api.HTTPClientOptions{
262 Log: ios.ErrOut,
263 LogColorize: ios.ColorEnabled(),
264 AppVersion: appVersion,
265 InvokingAgent: invokingAgent,
266 // This is required to prevent automatic setting of auth and other headers.
267 SkipDefaultHeaders: true,
268 TelemetryDisabler: telemetryDisabler,
269 }
270 client, err := api.NewHTTPClient(opts)
271 if err != nil {
272 return nil, err
273 }
274 return client, nil
275 }
276}
277
278// configWithTokenRefresher returns a config accessor that injects the OAuth token refresher into the AuthConfig the
279// 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