Documentation
¶
Overview ¶
Package test contains utility code used in tests
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type XRateLimitHTTPHandler ¶
type XRateLimitHTTPHandler struct { T *testing.T SuccessCode int SuccessBody string // contains filtered or unexported fields }
XRateLimitHTTPHandler first returns status 429 with the X-RateLimit-Next header set to time.Now() plus a random value between 1 and 5 milliseconds. It keeps sending 429 until the X-RateLimit-Next point in time. Then it starts to return SuccessCode and SuccessBody indefinitely.
func (*XRateLimitHTTPHandler) AvailableAt ¶
func (h *XRateLimitHTTPHandler) AvailableAt() time.Time
AvailableAt returns the point in time at which the handler stops returning status code 429
func (*XRateLimitHTTPHandler) ReturnTimes ¶
func (h *XRateLimitHTTPHandler) ReturnTimes() []time.Time
ReturnTimes returns a list of times at which subsequent responses were written
func (*XRateLimitHTTPHandler) ReturnedCodes ¶
func (h *XRateLimitHTTPHandler) ReturnedCodes() []int
ReturnedCodes returns a list of status codes from subsequent handler responses
func (*XRateLimitHTTPHandler) ServeHTTP ¶
func (h *XRateLimitHTTPHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request)
Click to show internal directories.
Click to hide internal directories.