MCPcopy
hub / github.com/caddyserver/caddy / NewTester

Function NewTester

caddytest/caddytest.go:68–84  ·  view source on GitHub ↗

NewTester will create a new testing client with an attached cookie jar

(t testing.TB)

Source from the content-addressed store, hash-verified

66
67// NewTester will create a new testing client with an attached cookie jar
68func NewTester(t testing.TB) *Tester {
69 jar, err := cookiejar.New(nil)
70 if err != nil {
71 t.Fatalf("failed to create cookiejar: %s", err)
72 }
73
74 return &Tester{
75 Client: &http.Client{
76 Transport: CreateTestingTransport(),
77 Jar: jar,
78 Timeout: Default.TestRequestTimeout,
79 },
80 configLoaded: false,
81 t: t,
82 config: Default,
83 }
84}
85
86// WithDefaultOverrides this will override the default test configuration with the provided values.
87func (tc *Tester) WithDefaultOverrides(overrides Config) *Tester {

Calls 1

CreateTestingTransportFunction · 0.85