Documentation ¶
Overview ¶
Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorResponse = http.Response{ StatusCode: http.StatusInternalServerError, Body: ioutil.NopCloser(bytes.NewReader([]byte(errorBody))), }
ErrorResponse simulates an error response.
Functions ¶
func AcceptedResponse ¶
AcceptedResponse creates a mock http.Response with a StatusAccepted code.
func ResetDeltasResponse ¶
func TooManyRequestsResponse ¶
func TooManyRequestsResponse(opts ...ResponseOption) http.Response
TooManyRequestsResponse creates a mock http.Response with a StatusTooManyRequests code.
Types ¶
type RequestRecorderClient ¶
type RequestRecorderClient struct { Client backendhttp.Client RequestCh chan http.Request }
RequestRecorderClient is an HTTP client that records the first arriving request.
func NewRequestRecorderClient ¶
func NewRequestRecorderClient(responses ...http.Response) *RequestRecorderClient
NewRequestRecorderClient creates a new RequestRecorderClient, passing the expected responses in order of invocation. If all the responses are returned or no responses are passed, it always returns "202 Status Accepted".
type ResponseOption ¶
func RetryAfter ¶
func RetryAfter(value string) ResponseOption
RetryAfter adds the `Retry-After` header to the HTTP response.
Click to show internal directories.
Click to hide internal directories.