MCPcopy Create free account
hub / github.com/cloudfoundry/multiapps-cli-plugin / newTransport

Function newTransport

commands/base_command.go:274–286  ·  view source on GitHub ↗
(isSslDisabled bool)

Source from the content-addressed store, hash-verified

272}
273
274func newTransport(isSslDisabled bool) http.RoundTripper {
275 csrfx := csrf.CsrfTokenHelper{NonProtectedMethods: getNonProtectedMethods()}
276 httpTransport := http.DefaultTransport.(*http.Transport).Clone()
277 // Increase tls handshake timeout to cope with slow internet connections. 3 x default value =30s.
278 httpTransport.TLSHandshakeTimeout = 30 * time.Second
279 httpTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: isSslDisabled}
280
281 // Wrap with User-Agent transport first
282 userAgentTransport := baseclient.NewUserAgentTransport(httpTransport)
283
284 // Then wrap with CSRF transport
285 return &csrf.Transport{Delegate: userAgentTransport, Csrf: &csrfx}
286}
287
288// NewTransportForTesting creates a transport for testing purposes
289func NewTransportForTesting(isSslDisabled bool) http.RoundTripper {

Callers 2

InitializeMethod · 0.85
NewTransportForTestingFunction · 0.85

Calls 2

NewUserAgentTransportFunction · 0.92
getNonProtectedMethodsFunction · 0.70

Tested by

no test coverage detected