Documentation
¶
Index ¶
- func ConsistOfHeaders(headers http.Header) types.GomegaMatcher
- func ContainHeaderKeys(keys []string) types.GomegaMatcher
- func ContainHeaders(headers http.Header) types.GomegaMatcher
- func ContainSubstrings(substrings []string) types.GomegaMatcher
- func HaveExactResponseBody(body string) types.GomegaMatcher
- func HaveHttpResponse(expected *HttpResponse) types.GomegaMatcher
- func HaveMedianLessThan(upperBound time.Duration) types.GomegaMatcher
- func HaveOkResponse() types.GomegaMatcher
- func HaveOkResponseWithHeaders(headers map[string]interface{}) types.GomegaMatcher
- func HavePartialResponseBody(substring string) types.GomegaMatcher
- func HavePercentileLessThan(percentile int, upperBound time.Duration) types.GomegaMatcher
- func HavePercentileWithin(percentile int, target, window time.Duration) types.GomegaMatcher
- func HaveStatusCode(statusCode int) types.GomegaMatcher
- type BeEquivalentToDiffMatcher
- type HaveHttpResponseMatcher
- type HttpResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsistOfHeaders ¶ added in v1.14.20
func ConsistOfHeaders(headers http.Header) types.GomegaMatcher
ConsistOfHeaders produces a matcher that will only match if all provided headers are completely accounted for, including multi-value headers. This matcher will fail if there are any extra headers that are not specified in the headers passed in.
func ContainHeaderKeys ¶ added in v1.15.12
func ContainHeaderKeys(keys []string) types.GomegaMatcher
ContainHeaderKeys produces a matcher that will only match if all provided header keys exist.
func ContainHeaders ¶
func ContainHeaders(headers http.Header) types.GomegaMatcher
ContainHeaders produces a matcher that will only match if all provided headers are completely accounted for, including multi-value headers.
func ContainSubstrings ¶
func ContainSubstrings(substrings []string) types.GomegaMatcher
ContainSubstrings produces a matcher that will match if all provided strings occur within the targeted string
func HaveExactResponseBody ¶
func HaveExactResponseBody(body string) types.GomegaMatcher
HaveExactResponseBody expects a 200 response with a body that matches the provided string
func HaveHttpResponse ¶
func HaveHttpResponse(expected *HttpResponse) types.GomegaMatcher
HaveHttpResponse returns a GomegaMatcher which validates that an http.Response contains particular expected properties (status, body..etc) If an expected body isn't specified, the body is not matched
func HaveMedianLessThan ¶ added in v1.15.0
func HaveMedianLessThan(upperBound time.Duration) types.GomegaMatcher
HaveMedianLessThan returns a matcher requiring the given slice of durations have a median value less than the given upperBound
func HaveOkResponse ¶
func HaveOkResponse() types.GomegaMatcher
HaveOkResponse expects a http response with a 200 status code
func HaveOkResponseWithHeaders ¶
func HaveOkResponseWithHeaders(headers map[string]interface{}) types.GomegaMatcher
HaveOkResponseWithHeaders expects an 200 response with a set of headers that match the provided headers
func HavePartialResponseBody ¶
func HavePartialResponseBody(substring string) types.GomegaMatcher
HavePartialResponseBody expects a 200 response with a body that contains the provided substring
func HavePercentileLessThan ¶ added in v1.15.0
func HavePercentileLessThan(percentile int, upperBound time.Duration) types.GomegaMatcher
HavePercentileLessThan returns a matcher requiring the given slice of durations to be less than the given upperBound at the given percentile
func HavePercentileWithin ¶ added in v1.15.0
func HavePercentileWithin(percentile int, target, window time.Duration) types.GomegaMatcher
HavePercentileWithin returns a matcher requiring the given slice of durations to be within a window of a given target at the given percentile
func HaveStatusCode ¶
func HaveStatusCode(statusCode int) types.GomegaMatcher
HaveStatusCode expects a http response with a particular status code
Types ¶
type BeEquivalentToDiffMatcher ¶
type BeEquivalentToDiffMatcher struct {
matchers.BeEquivalentToMatcher
}
func BeEquivalentToDiff ¶
func BeEquivalentToDiff(expected interface{}) *BeEquivalentToDiffMatcher
BeEquivalentToDiff is the same as BeEquivalentTo but prints a nice diff on failure best effect use ginkgo with -noColor
func (*BeEquivalentToDiffMatcher) FailureMessage ¶
func (matcher *BeEquivalentToDiffMatcher) FailureMessage(actual interface{}) (message string)
func (*BeEquivalentToDiffMatcher) NegatedFailureMessage ¶
func (matcher *BeEquivalentToDiffMatcher) NegatedFailureMessage(actual interface{}) (message string)
type HaveHttpResponseMatcher ¶
type HaveHttpResponseMatcher struct { Expected *HttpResponse // contains filtered or unexported fields }
func (*HaveHttpResponseMatcher) FailureMessage ¶
func (m *HaveHttpResponseMatcher) FailureMessage(actual interface{}) (message string)
func (*HaveHttpResponseMatcher) Match ¶
func (m *HaveHttpResponseMatcher) Match(actual interface{}) (success bool, err error)
func (*HaveHttpResponseMatcher) NegatedFailureMessage ¶
func (m *HaveHttpResponseMatcher) NegatedFailureMessage(actual interface{}) (message string)
type HttpResponse ¶
type HttpResponse struct { // StatusCode is the expected status code for an http.Response // Required StatusCode int // Body is the expected response body for an http.Response // Body can be of type: {string, bytes, GomegaMatcher} // Optional: If not provided, defaults to an empty string Body interface{} // Headers is the set of expected header values for an http.Response // Each header can be of type: {string, GomegaMatcher} // Optional: If not provided, does not perform header validation Headers map[string]interface{} // Custom is a generic matcher that can be applied to validate any other properties of an http.Response // Optional: If not provided, does not perform additional validation Custom types.GomegaMatcher }
HttpResponse defines the set of properties that we can validate from an http.Response