Documentation ¶
Index ¶
- func DecodeBody(encodedBody []byte, contentEncodingHeader []string, contentTypeHeader []string) (interface{}, error)
- func FilterHeaders(headers map[string][]string, exclude []string) map[string][]string
- func Generate(config config.Records, payload RecordPayload) ([]byte, error)
- func GenerateRequest(recordRequest Request) (*http.Request, error)
- func GetContentEncoding(contentEncodingHeader []string) string
- func GetContentType(contentTypeHeader []string) string
- func Gunzip(data []byte) ([]byte, error)
- func Gzip(data []byte) ([]byte, error)
- func ValidateRecords(records []Record) ([]string, error)
- type Metadata
- type Record
- type RecordPayload
- type Request
- type Response
- type Session
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeBody ¶
func FilterHeaders ¶
func GetContentEncoding ¶
func GetContentType ¶
func ValidateRecords ¶
Types ¶
type Record ¶
type Record struct { Request Request `json:"request"` Response Response `json:"response"` Metadata Metadata `json:"metadata"` }
func DecodeRecords ¶
func ExtractRecords ¶
type RecordPayload ¶
type RecordPayload struct { Hash string Curl string Scheme string HttpMethod string Host string Path string Query map[string][]string RequestHeaders map[string][]string RequestBody []byte StatusCode int ResponseHeaders map[string][]string ResponseBody []byte }
func GenerateRecordPayload ¶
func GenerateRecordPayload(session Session, hash string, curl string) (RecordPayload, error)
type Request ¶
type Request struct { Hash string `json:"hash"` Curl string `json:"curl"` Scheme string `json:"scheme" validate:"required,oneof=http https"` HttpMethod string `json:"httpMethod" validate:"required,oneof=GET POST PUT DELETE PATCH HEAD CONNECT OPTIONS TRACE"` Host string `json:"host" validate:"required"` Path string `json:"path"` Query map[string][]string `json:"query"` Headers map[string][]string `json:"headers"` Body interface{} `json:"body" validate:"required_if=HttpMethod POST,required_if=HttpMethod PUT,required_if=HttpMethod PATCH"` }
Click to show internal directories.
Click to hide internal directories.