Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPResponseFromFile ¶
HTTPResponseFromFile creates a response object from the contents of a file. It uses to suffix of the filename to determine the content-type
Types ¶
type APIRequest ¶
type APIRequest struct {
Headers map[string]string
Method string
Path string
RequestJSON interface{} //if non-nil, will be encoded as JSON
ExpectStatusCode int
ExpectBody *string //raw content (not a file path)
ExpectJSON string //path to JSON file
ExpectFile string //path to arbitrary file
}
APIRequest contains all metadata about a test request.
type HTTPRequestMatcher ¶
type HTTPRequestMatcher struct {
gomock.Matcher
// ExpectHeader contains the required header fields and a regexp pattern to match
ExpectHeader map[string]string
// InjectHeader contains the new fields to be injected
InjectHeader map[string]string
}
HTTPRequestMatcher matches against http.Request parameters Optionally it can check the header-contents and inject new header-fields as a side-effect
func (HTTPRequestMatcher) Matches ¶
func (m HTTPRequestMatcher) Matches(x interface{}) bool
Matches checks for expected headers (precondition) and injects additional ones (postcondition)
func (HTTPRequestMatcher) String ¶
func (m HTTPRequestMatcher) String() string
type TimeStringMatcher ¶
TimeStringMatcher matches strings containing timestamps
func (TimeStringMatcher) Matches ¶
func (m TimeStringMatcher) Matches(x interface{}) bool
Matches checks whether the string is a valid RFC3339 or Unix timestamp
func (TimeStringMatcher) String ¶
func (m TimeStringMatcher) String() string
Click to show internal directories.
Click to hide internal directories.