Documentation ¶
Overview ¶
Package recorder allows to capture request/response pairs via a reverse proxy and generate tests for these pairs.
Index ¶
- Variables
- func DumpEvents(events []Event, directory string, suitename string) error
- func ExtractCommonRequestHeaders(events []Event) http.Header
- func ExtractCommonResponseHeaders(events []Event) http.Header
- func StartReverseProxy(port string, remoteURL *url.URL, opts Options) error
- type Event
- type Options
- type Suite
- type Test
Constants ¶
This section is empty.
Variables ¶
View Source
var Events []Event
Events is the global list of recorded events.
Functions ¶
func DumpEvents ¶
DumpEvents writes events to directory, it extracts common request headers.
func ExtractCommonRequestHeaders ¶
ExtractCommonRequestHeaders from events.
func ExtractCommonResponseHeaders ¶
ExtractCommonResponseHeaders from events.
Types ¶
type Event ¶
type Event struct { Request *http.Request // The request. Response *httptest.ResponseRecorder // The recorded response. RequestBody string // The captured body. ResponseBody string Timestamp time.Time // Timestamp when caputred. Name string // Used during dumping. }
Event is a request/response pair.
type Options ¶
type Options struct { // Disarm is the time span after a captured request/response pair // in which the capturing is disarmed. Disarm time.Duration // IgnoredContentType allows to skip capturing a request whose // Content-Type header matches. IgnoredContentType *regexp.Regexp // IgnoredPath allows to skip capturing events based on the // requested path, IgnoredPath *regexp.Regexp // RewriteAbsoluteURLs allows to rewrite Location headers an // href and src attributes in HTML bodies. RewriteAbsoluteURLs bool }
Options determining which and how events should be captured.
Click to show internal directories.
Click to hide internal directories.