MCPcopy
hub / github.com/assetnote/kiterunner / HTTPClient

Method HTTPClient

pkg/http/target.go:228–236  ·  view source on GitHub ↗

HTTPClient will return a HTTPClient configured for the particular target with the configured maxConnections and timeout. This is cached after the first call, so subsequent changes to the Host and IsTLS after the first call of HTTPClient will not be respected

(maxConnections int, timeout time.Duration)

Source from the content-addressed store, hash-verified

226// This is cached after the first call, so subsequent changes to the Host and IsTLS after the
227// first call of HTTPClient will not be respected
228func (t *Target) HTTPClient(maxConnections int, timeout time.Duration) *HTTPClient {
229 if t.httpClient == nil {
230 t.httpClient = NewHTTPClient(t.Host(), t.IsTLS)
231 t.httpClient.SetMaxConns(maxConnections)
232 t.httpClient.ReadTimeout = timeout
233 t.httpClient.WriteTimeout = timeout
234 }
235 return t.httpClient
236}
237
238// AppendBytes will append the full request details including the headers and scheme to the provided buffer
239// e.g. http://google.com:80/foo {x-forwarded-for:127.0.0.1}

Calls 2

HostMethod · 0.95
NewHTTPClientFunction · 0.85