Documentation ¶
Index ¶
Constants ¶
View Source
const ( OCTET_STREAM = "application/octet-stream" JSON = "application/json; charset=utf-8" TEXT = "text/plain" )
Variables ¶
View Source
var DefaultRoundTripper http.RoundTripper = &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).DialContext, MaxIdleConns: 100, IdleConnTimeout: 90 * time.Second, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, }
Functions ¶
func ResetDefaultRoundTripper ¶
func ResetDefaultRoundTripper()
Types ¶
type CannedResponse ¶ added in v1.1.0
type CannedResponse struct { ResponseType ResponseType Response string ContentType string }
type ExpectedCommand ¶ added in v1.3.0
type ExpectedCommand struct {
// contains filtered or unexported fields
}
type FakeRunner ¶ added in v1.3.0
type FakeRunner struct {
*Runner
}
func NewFakeRunner ¶ added in v1.3.0
func NewFakeRunner(test *testing.T) *FakeRunner
func (*FakeRunner) ExpectAndReturn ¶ added in v1.3.0
func (f *FakeRunner) ExpectAndReturn(input string, output string)
type MockRoundTripper ¶
type MockRoundTripper struct {
// contains filtered or unexported fields
}
MockRoundTripper mocks HTTP requests and allows to return canned responses
func NewMockRoundTripper ¶
func NewMockRoundTripper() *MockRoundTripper
func (*MockRoundTripper) AllowDelegation ¶ added in v1.1.0
func (t *MockRoundTripper) AllowDelegation(delegate bool)
func (*MockRoundTripper) RegisterResponse ¶ added in v1.1.0
func (t *MockRoundTripper) RegisterResponse(url string, response *CannedResponse)
func (*MockRoundTripper) Verbose ¶ added in v1.1.0
func (t *MockRoundTripper) Verbose(verbose bool)
type ResponseType ¶ added in v1.1.0
type ResponseType int
const ( SERVE_STRING ResponseType = iota SERVE_FILE )
type Tee ¶ added in v1.10.0
type Tee struct { OrigStdout *os.File OrigStderr *os.File Stdout *os.File Stderr *os.File StdoutBuffer *bytes.Buffer StderrBuffer *bytes.Buffer // contains filtered or unexported fields }
func NewTee ¶ added in v1.10.0
NewTee splits os.Stdout and os.Stderr using a pipe. While the tee is not closed data written to stdout or stderr will be copied into a buffer as well well as printed to the original file handle, unless silent is true, in which case the original output streams are silenced.
Click to show internal directories.
Click to hide internal directories.