Documentation ¶
Index ¶
Constants ¶
View Source
const ( OCTET_STREAM = "application/octet-stream" JSON = "application/json; charset=utf-8" )
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 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 )
Click to show internal directories.
Click to hide internal directories.