MCPcopy
hub / github.com/moby/moby / TestWithHTTPClient

Function TestWithHTTPClient

client/client_options_test.go:407–425  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

405}
406
407func TestWithHTTPClient(t *testing.T) {
408 cookieJar, err := cookiejar.New(nil)
409 assert.NilError(t, err)
410 pristineHTTPClient := func() *http.Client {
411 return &http.Client{
412 Timeout: 42 * time.Second,
413 Jar: cookieJar,
414 Transport: &http.Transport{
415 TLSClientConfig: &tls.Config{ServerName: "example.com", MinVersion: tls.VersionTLS12},
416 },
417 }
418 }
419 hc := pristineHTTPClient()
420 _, err = New(WithHTTPClient(hc), WithHost("tcp://example.com:443"))
421 assert.NilError(t, err)
422 assert.DeepEqual(t, hc, pristineHTTPClient(),
423 cmpopts.IgnoreUnexported(http.Transport{}, tls.Config{}),
424 cmpopts.EquateComparable(&cookiejar.Jar{}))
425}
426
427func TestWithResponseHook(t *testing.T) {
428 const hdrKey = "X-Test-Header"

Callers

nothing calls this directly

Calls 4

WithHTTPClientFunction · 0.85
WithHostFunction · 0.85
NewFunction · 0.70
NewMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…