Documentation
¶
Index ¶
- func DELETE() types.BeMatcher
- func GET() types.BeMatcher
- func HavingBody(args ...any) types.BeMatcher
- func HavingHeader(key string, args ...any) types.BeMatcher
- func HavingHost(args ...any) types.BeMatcher
- func HavingMethod(args ...any) types.BeMatcher
- func HavingProto(args ...any) types.BeMatcher
- func HavingURL(args ...any) types.BeMatcher
- func OPTIONS() types.BeMatcher
- func PATCH() types.BeMatcher
- func POST() types.BeMatcher
- func PUT() types.BeMatcher
- func Request(args ...any) types.BeMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DELETE ¶
DELETE returns a matcher that succeeds if the actual *http.Request has a method "DELETE".
func HavingBody ¶
HavingBody succeeds if the actual value is a *http.Request and its body matches the provided arguments. Note: The body is not re-streamed, so it's not available after matching.
func HavingHeader ¶
HavingHeader matches requests that have header with a given key. (1) If no args are given, it simply matches a request with existed header by key. (2) If len(args) == 1 && args[0] is a stringish, it matches a request with header `Key: Args[0]` (3) if len(args) == 1 && args[0] is not stringish, it is considered to be matcher for header's value Examples: - HavingHeader("X-Header") matches request with non-empty X-Header header - HavingHeader("X-Header", "X-Value") matches request with X-Header: X-Value - HavingHeader("X-Header", HavePrefix("Bearer ")) matchers request with header(X-Header)'s value matching given HavePrefix matcher - todo: support multiple header values todo: fixme I'm ugly for now
func HavingHost ¶
HavingHost succeeds if the actual value is a *http.Request and its Host matches the provided arguments.
func HavingMethod ¶
HavingMethod succeeds if the actual value is a *http.Request and its HTTP method matches the provided arguments.
func HavingProto ¶
HavingProto succeeds if the actual value is a *http.Request and its Proto matches the provided arguments.
func HavingURL ¶
HavingURL succeeds if the actual value is a *http.Request and its URL matches the provided arguments.
func OPTIONS ¶
OPTIONS returns a matcher that succeeds if the actual *http.Request has a method "OPTIONS".
func PATCH ¶
PATCH returns a matcher that succeeds if the actual *http.Request has a method "PATCH".
func Request ¶
Request matches an actual value to be a valid *http.Request corresponding to given inputs. Possible inputs: 1. Nil args -> so actual value MUST be any valid *http.Request. 2. Single arg <string>. Actual value MUST be a *http.Request, whose .URL.String() is compared against args[0]. 3. List of Omega/Gomock/Psi matchers, that are applied to *http.Request object.
- Supports matching http.Request properties like method, URL, body, host, proto, and headers.
- Additional arguments can be used for matching specific headers, e.g., WithHeader("Content-Type", "application/json").
Types ¶
This section is empty.