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

Function plainHttpClientFunc

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

Source from the content-addressed store, hash-verified

210}
211
212func plainHttpClientFunc(ios *iostreams.IOStreams, appVersion string, invokingAgent string, telemetryDisabler ghtelemetry.Disabler) func() (*http.Client, error) {
213 return func() (*http.Client, error) {
214 opts := api.HTTPClientOptions{
215 Log: ios.ErrOut,
216 LogColorize: ios.ColorEnabled(),
217 AppVersion: appVersion,
218 InvokingAgent: invokingAgent,
219 // This is required to prevent automatic setting of auth and other headers.
220 SkipDefaultHeaders: true,
221 TelemetryDisabler: telemetryDisabler,
222 }
223 client, err := api.NewHTTPClient(opts)
224 if err != nil {
225 return nil, err
226 }
227 return client, nil
228 }
229}
230
231func externalHttpClientFunc(ios *iostreams.IOStreams, appVersion string) func() (*http.Client, error) {
232 return func() (*http.Client, error) {

Callers 2

TestPlainHttpClientFunction · 0.85
NewFunction · 0.85

Calls 2

NewHTTPClientFunction · 0.92
ColorEnabledMethod · 0.80

Tested by 1

TestPlainHttpClientFunction · 0.68