Documentation ¶
Index ¶
- Constants
- func Add(h http.Handler, middleware ...func(http.Handler) http.Handler) http.Handler
- func AddLatency(next http.Handler) http.Handler
- func ErrorResponse(handler http.Handler) http.Handler
- func GetErrorSinkHoleDuration() time.Duration
- func RateLimit(handler http.Handler) http.Handler
- func SetErrorSinkHoleDuration(duration time.Duration)
Constants ¶
const Error500ResponseEnvName = "DATABRICKS_MOCK_API_ERROR_500_PROBABILITY"
Error500ResponseEnvName is the name of the env var for specifying the probability of returning a 500 response. E.g. 20 => 20% chance of returning a 500 response
const ErrorSinkHoleResponseEnvName = "DATABRICKS_MOCK_API_ERROR_SINKHOLE_PROBABILITY"
ErrorSinkHoleResponseEnvName is name of the env var for specifying the probability of a sink-hole response. A sink-hole response is a request that writes nothing as part of the response for an extended period (5 minutes) and holds open the connection during that time. E.g. 20 => 20% chance of returning a sink-hole response
const ErrorXMLResponseEnvName = "DATABRICKS_MOCK_API_ERROR_XML_RESPONSE_PROBABILITY"
ErrorXMLResponseEnvName is the name of the env var for specifying status code of 200 but with XML body
const LatencyFastRequestMaxEnvName = "DATABRICKS_MOCK_API_LATENCY_MILLISECONDS_FAST_REQUEST_MAX"
LatencyFastRequestMaxEnvName is the name of the env var for the max latency setting of a fast request Eg: Get request
const LatencyFastRequestMinEnvName = "DATABRICKS_MOCK_API_LATENCY_MILLISECONDS_FAST_REQUEST_MIN"
LatencyFastRequestMinEnvName is the name of the env var for the min latency setting of a fast request Eg: Get request
const LatencySlowRequestMaxEnvName = "DATABRICKS_MOCK_API_LATENCY_MILLISECONDS_SLOW_REQUEST_MAX"
LatencySlowRequestMaxEnvName is the name of the env var for the max latency setting of a slow request Eg: Post request
const LatencySlowRequestMinEnvName = "DATABRICKS_MOCK_API_LATENCY_MILLISECONDS_SLOW_REQUEST_MIN"
LatencySlowRequestMinEnvName is the name of the env var for the min latency setting of a slow request Eg: Post request
const RateLimitEnvName = "DATABRICKS_MOCK_API_RATE_LIMIT"
RateLimitEnvName is the name of the env var for the rate limit setting
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add applies a set of middleware to a http.Handler. Middleware is applied so that it executes in the order specified. E.g. middleware.Add(h, mw1, mw2) is equivalent to mw2(mw1(h))
func AddLatency ¶
AddLatency applies random latency to the request
func ErrorResponse ¶
ErrorResponse injects error behavior based on config
func GetErrorSinkHoleDuration ¶
GetErrorSinkHoleDuration returns the duration used for sink-hole requests
func SetErrorSinkHoleDuration ¶
SetErrorSinkHoleDuration sets the duration used for sink-hole requests
Types ¶
This section is empty.