models

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2016 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

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 ValidateResponseDelayJson

func ValidateResponseDelayJson(j ResponseDelayPayload) (err error)

Types

type RequestDetails

type RequestDetails struct {
	Path        string              `json:"path"`
	Method      string              `json:"method"`
	Destination string              `json:"destination"`
	Scheme      string              `json:"scheme"`
	Query       string              `json:"query"`
	Body        string              `json:"body"`
	Headers     map[string][]string `json:"headers"`
}

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 NewRequestDetailsFromRequestDetailsView added in v0.8.0

func NewRequestDetailsFromRequestDetailsView(data views.RequestDetailsView) RequestDetails

func (*RequestDetails) ConvertToRequestDetailsView

func (this *RequestDetails) ConvertToRequestDetailsView() views.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 `json:"response"`
	Request  RequestDetails  `json:"request"`
}

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 views.RequestResponsePairView) RequestResponsePair

func (*RequestResponsePair) ConvertToRequestResponsePairView added in v0.8.1

func (this *RequestResponsePair) ConvertToRequestResponsePairView() *views.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 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) GetDelay added in v0.7.1

func (this *ResponseDelayList) GetDelay(request RequestDetails) *ResponseDelay

func (*ResponseDelayList) Json added in v0.7.1

func (this *ResponseDelayList) Json() []byte

func (*ResponseDelayList) Len added in v0.7.1

func (this *ResponseDelayList) Len() int

type ResponseDelayPayload added in v0.8.2

type ResponseDelayPayload struct {
	Data *ResponseDelayList `json:"data"`
}

type ResponseDelays added in v0.7.1

type ResponseDelays interface {
	Json() []byte
	GetDelay(request RequestDetails) *ResponseDelay
	Len() int
}

type ResponseDetails

type ResponseDetails struct {
	Status  int                 `json:"status"`
	Body    string              `json:"body"`
	Headers map[string][]string `json:"headers"`
}

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 NewResponseDetailsFromResponseDetailsView added in v0.8.1

func NewResponseDetailsFromResponseDetailsView(data views.ResponseDetailsView) ResponseDetails

func (*ResponseDetails) ConvertToResponseDetailsView

func (r *ResponseDetails) ConvertToResponseDetailsView() views.ResponseDetailsView

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL