Documentation ¶
Index ¶
- func MockError() func(http.ResponseWriter, *http.Request, map[string]string)
- func MockResource(postHandler PostHandler, filenames ...string) func(http.ResponseWriter, *http.Request, map[string]string)
- func MockResourceID(filename string) func(http.ResponseWriter, *http.Request, map[string]string)
- func MockResourceRateLimit() func(http.ResponseWriter, *http.Request, map[string]string)
- func NewMock(postHandler PostHandler, dir string, lastRequestHeader ...*map[string][]string) (*http.Client, string)
- type PostHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MockResource ¶
func MockResource(postHandler PostHandler, filenames ...string) func(http.ResponseWriter, *http.Request, map[string]string)
MockResource returns a response with mock data from a resource file in the data/ directory.
func MockResourceID ¶
MockResourceID returns data for the document with a specific ID. It takes a filename and reads the corresponding file in data/, then returns the data for the object that has a matching ID, or an error if there is no object in that file with the ID.
func MockResourceRateLimit ¶
MockResourceRateLimit sets mock rate-limiting header values on a response.
Types ¶
Click to show internal directories.
Click to hide internal directories.