Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Error is a trigger to fail with http.Error
Error bool
// ErrorText is an argument for http.Error in the case of Error == true
ErrorText string
// Code is a status code returned in response
Code int
// Delay represents the amount of time that handler will wait before response
Delay time.Duration
// FailEachNthRequest defines the period of requests failure
FailEachNthRequest int
// FailEachNthCode defines the status code to be returned during periodical requests failure
FailEachNthCode int
// FailThreshold defines the threshold of successfully processed requests, after which mocked responses will be returned
FailThreshold int
// FailThresholdCode defines the status code to be returned after threshold overcome
FailThresholdCode int
// pemPath and keyPath are paths to certs that required by https server
PemPath string
KeyPath string
}
Options represents the amount of options for mock ups
type Proxy ¶
type Proxy struct {
// FailEachNthRequestCounter is a counter required for failing condition on each nth request
FailEachNthRequestCounter int
// FailThresholdCounter is a counter required for failing condition after threshold has been reached
FailThresholdCounter int
// contains filtered or unexported fields
}
Proxy is a struct of proxy wrapper
func NewProxy ¶
func NewProxy(transport http.RoundTripper, options *Options) (*Proxy, error)
NewProxy is a proxy constructor
func (*Proxy) SetTransportProxy ¶ added in v0.1.0
SetTransportProxy changes http.DefaultTransport to the one that uses current server as a proxy
Click to show internal directories.
Click to hide internal directories.