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)
| 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 |
| 228 | func (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} |