Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { URL string `json:"url"` Method string `json:"method"` Headers map[string][]string `json:"headers"` // Right now we assume that the body is text Body string `json:"body"` }
Request represents an http.Request that we can store on disk.
func NewRequest ¶
NewRequest creates a new Request object, excluding certain headers. It returns an error if there is an issue reading from the body or closing the body.
func ReadRequestFromFile ¶
ReadRequestFromFile reads a Request from a file and returns it, or an error if the file cannot be read or the Request cannot be unmarshalled.
type Response ¶
type Response struct { StatusCode int `json:"statusCode"` Headers map[string][]string `json:"headers"` // Right now we assume that the body is text Body string `json:"body"` }
Response represents an http.Response that we can store on disk.
func NewResponse ¶
NewResponse creates a new Response object, excluding certain headers. It returns an error if there is an issue reading from the body or closing it.
func ReadResponseFromFile ¶
ReadResponseFromFile reads a Response from a file at the given path and returns it, or an error if the file could not be read or the Response could not be unmarshalled.
func (Response) CreateRoundTripper ¶
func (res Response) CreateRoundTripper() *RoundTripper
CreateRoundTripper creates a RoundTripper instance with the Response instance as its Response field.
type RoundTripper ¶
RoundTripper is a single-use http.RoundTripper implementation that can capture a request and produces a pre-configured response.