-
Notifications
You must be signed in to change notification settings - Fork 204
/
simulation_views_v3.go
73 lines (55 loc) · 2.73 KB
/
simulation_views_v3.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package v2
import (
"github.com/SpectoLabs/hoverfly/core/interfaces"
)
type SimulationViewV3 struct {
DataViewV3 `json:"data"`
MetaView `json:"meta"`
}
type DataViewV3 struct {
RequestResponsePairs []RequestMatcherResponsePairViewV3 `json:"pairs"`
GlobalActions GlobalActionsView `json:"globalActions"`
}
type RequestMatcherResponsePairViewV3 struct {
Response ResponseDetailsViewV3 `json:"response"`
RequestMatcher RequestMatcherViewV3 `json:"request"`
}
// RequestDetailsView is used when marshalling and unmarshalling RequestDetails
type RequestMatcherViewV3 struct {
Path *RequestFieldMatchersView `json:"path,omitempty"`
Method *RequestFieldMatchersView `json:"method,omitempty"`
Destination *RequestFieldMatchersView `json:"destination,omitempty"`
Scheme *RequestFieldMatchersView `json:"scheme,omitempty"`
Query *RequestFieldMatchersView `json:"query,omitempty"`
Body *RequestFieldMatchersView `json:"body,omitempty"`
Headers map[string][]string `json:"headers,omitempty"`
}
// Gets Response - required for interfaces.RequestResponsePairView
func (this RequestMatcherResponsePairViewV3) GetResponse() interfaces.Response { return this.Response }
type ResponseDetailsViewV3 struct {
Status int `json:"status"`
Body string `json:"body"`
EncodedBody bool `json:"encodedBody"`
Headers map[string][]string `json:"headers,omitempty"`
Templated bool `json:"templated"`
}
// Gets Status - required for interfaces.Response
func (this ResponseDetailsViewV3) GetStatus() int { return this.Status }
// Gets Body - required for interfaces.Response
func (this ResponseDetailsViewV3) GetBody() string { return this.Body }
// Gets BodyFile - required for interfaces.Response
func (this ResponseDetailsViewV3) GetBodyFile() string { return "" }
// Gets EncodedBody - required for interfaces.Response
func (this ResponseDetailsViewV3) GetEncodedBody() bool { return this.EncodedBody }
func (this ResponseDetailsViewV3) GetTemplated() bool { return this.Templated }
// Gets Headers - required for interfaces.Response
func (this ResponseDetailsViewV3) GetHeaders() map[string][]string { return this.Headers }
func (this ResponseDetailsViewV3) GetTransitionsState() map[string]string { return nil }
func (this ResponseDetailsViewV3) GetRemovesState() []string { return nil }
// Gets FixedDelay - required for interfaces.Response
func (this ResponseDetailsViewV3) GetFixedDelay() int { return 0 }
// Gets LogNormalDelay - required for interfaces.Response
func (this ResponseDetailsViewV3) GetLogNormalDelay() interfaces.ResponseDelay { return nil }
func (this ResponseDetailsViewV3) GetPostServeAction() string {
return ""
}