Documentation ¶
Index ¶
- func CopyBody(body io.ReadCloser) (resp1, resp2 io.ReadCloser, err error)
- func ValidateResponseDelayPayload(j v1.ResponseDelayPayloadView) (err error)
- type RequestDetails
- type RequestResponsePair
- func (this *RequestResponsePair) ConvertToRequestResponsePairView() v2.RequestResponsePairView
- func (this *RequestResponsePair) ConvertToV1RequestResponsePairView() *v1.RequestResponsePairView
- func (this *RequestResponsePair) Encode() ([]byte, error)
- func (this RequestResponsePair) Id() string
- func (this RequestResponsePair) IdWithoutHost() string
- type RequestTemplate
- type RequestTemplateResponsePair
- func (this *RequestTemplateResponsePair) ConvertToRequestResponsePairView() v2.RequestResponsePairView
- func (this *RequestTemplateResponsePair) ConvertToRequestTemplateResponsePairView() v1.RequestTemplateResponsePairView
- func (this *RequestTemplateResponsePair) ConvertToV1RequestResponsePairView() v1.RequestResponsePairView
- type ResponseDelay
- type ResponseDelayList
- type ResponseDelays
- type ResponseDetails
- type Simulation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyBody ¶ added in v0.8.2
func CopyBody(body io.ReadCloser) (resp1, resp2 io.ReadCloser, err error)
func ValidateResponseDelayPayload ¶ added in v0.9.0
func ValidateResponseDelayPayload(j v1.ResponseDelayPayloadView) (err error)
Types ¶
type RequestDetails ¶
type RequestDetails struct { Path string Method string Destination string Scheme string Query string Body string Headers map[string][]string }
RequestDetails stores information about request, it's used for creating unique hash and also as a payload structure
func NewRequestDetailsFromHttpRequest ¶ added in v0.8.2
func NewRequestDetailsFromHttpRequest(req *http.Request) (RequestDetails, error)
func NewRequestDetailsFromRequest ¶ added in v0.9.0
func NewRequestDetailsFromRequest(data interfaces.Request) RequestDetails
func (*RequestDetails) ConvertToRequestDetailsView ¶
func (this *RequestDetails) ConvertToRequestDetailsView() v2.RequestDetailsView
func (*RequestDetails) ConvertToV1RequestDetailsView ¶ added in v0.9.0
func (this *RequestDetails) ConvertToV1RequestDetailsView() v1.RequestDetailsView
func (*RequestDetails) Hash ¶
func (r *RequestDetails) Hash() string
func (*RequestDetails) HashWithoutHost ¶
func (r *RequestDetails) HashWithoutHost() string
type RequestResponsePair ¶ added in v0.8.1
type RequestResponsePair struct { Response ResponseDetails Request RequestDetails }
Payload structure holds request and response structure
func NewRequestResponsePairFromBytes ¶ added in v0.8.1
func NewRequestResponsePairFromBytes(data []byte) (*RequestResponsePair, error)
NewPayloadFromBytes decodes supplied bytes into Payload structure
func NewRequestResponsePairFromRequestResponsePairView ¶ added in v0.8.1
func NewRequestResponsePairFromRequestResponsePairView(pairView interfaces.RequestResponsePair) RequestResponsePair
func (*RequestResponsePair) ConvertToRequestResponsePairView ¶ added in v0.8.1
func (this *RequestResponsePair) ConvertToRequestResponsePairView() v2.RequestResponsePairView
func (*RequestResponsePair) ConvertToV1RequestResponsePairView ¶ added in v0.9.0
func (this *RequestResponsePair) ConvertToV1RequestResponsePairView() *v1.RequestResponsePairView
func (*RequestResponsePair) Encode ¶ added in v0.8.1
func (this *RequestResponsePair) Encode() ([]byte, error)
Encode method encodes all exported Payload fields to bytes
func (RequestResponsePair) Id ¶ added in v0.8.1
func (this RequestResponsePair) Id() string
func (RequestResponsePair) IdWithoutHost ¶ added in v0.8.1
func (this RequestResponsePair) IdWithoutHost() string
type RequestTemplate ¶ added in v0.10.2
type RequestTemplateResponsePair ¶ added in v0.10.2
type RequestTemplateResponsePair struct { RequestTemplate RequestTemplate Response ResponseDetails }
func (*RequestTemplateResponsePair) ConvertToRequestResponsePairView ¶ added in v0.10.2
func (this *RequestTemplateResponsePair) ConvertToRequestResponsePairView() v2.RequestResponsePairView
func (*RequestTemplateResponsePair) ConvertToRequestTemplateResponsePairView ¶ added in v0.10.2
func (this *RequestTemplateResponsePair) ConvertToRequestTemplateResponsePairView() v1.RequestTemplateResponsePairView
func (*RequestTemplateResponsePair) ConvertToV1RequestResponsePairView ¶ added in v0.10.2
func (this *RequestTemplateResponsePair) ConvertToV1RequestResponsePairView() v1.RequestResponsePairView
DEPRICATED - Once we remove the v1 API, this will also go
type ResponseDelay ¶
type ResponseDelay struct { UrlPattern string `json:"urlPattern"` HttpMethod string `json:"httpMethod"` Delay int `json:"delay"` }
func (*ResponseDelay) Execute ¶
func (this *ResponseDelay) Execute()
type ResponseDelayList ¶ added in v0.7.1
type ResponseDelayList []ResponseDelay
func (ResponseDelayList) ConvertToResponseDelayPayloadView ¶ added in v0.9.0
func (this ResponseDelayList) ConvertToResponseDelayPayloadView() v1.ResponseDelayPayloadView
func (*ResponseDelayList) GetDelay ¶ added in v0.7.1
func (this *ResponseDelayList) GetDelay(request RequestDetails) *ResponseDelay
func (*ResponseDelayList) Len ¶ added in v0.7.1
func (this *ResponseDelayList) Len() int
type ResponseDelays ¶ added in v0.7.1
type ResponseDelays interface { GetDelay(request RequestDetails) *ResponseDelay Len() int ConvertToResponseDelayPayloadView() v1.ResponseDelayPayloadView }
type ResponseDetails ¶
ResponseDetails structure hold response body from external service, body is not decoded and is supposed to be bytes, however headers should provide all required information for later decoding by the client.
func NewResponseDetailsFromResponse ¶ added in v0.9.0
func NewResponseDetailsFromResponse(data interfaces.Response) ResponseDetails
func (*ResponseDetails) ConvertToResponseDetailsView ¶
func (r *ResponseDetails) ConvertToResponseDetailsView() v2.ResponseDetailsView
This function will create a JSON appriopriate version of ResponseDetails for the v2 API If the response headers indicate that the content is encoded, or it has a non-matching supported mimetype, we base64 encode it.
func (*ResponseDetails) ConvertToV1ResponseDetailsView ¶ added in v0.9.0
func (r *ResponseDetails) ConvertToV1ResponseDetailsView() v1.ResponseDetailsView
This function will create a JSON appriopriate version of ResponseDetails for the v1 API If the response headers indicate that the content is encoded, or it has a non-matching supported mimetype, we base64 encode it.
type Simulation ¶ added in v0.10.2
type Simulation struct {
Templates []RequestTemplateResponsePair
}
func NewSimulation ¶ added in v0.10.2
func NewSimulation() *Simulation