MCPcopy Index your code
hub / github.com/cli/cli / plainHttpClientFunc

Function plainHttpClientFunc

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

Source from the content-addressed store, hash-verified

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