-
Notifications
You must be signed in to change notification settings - Fork 22
/
constants.go
93 lines (78 loc) · 3.13 KB
/
constants.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package apis
// Action is a string representing the action to perform
type Action string
const (
// Editor possible user actions
// EDT_FORWARD tells the backend to forward the currently intercepted request/response
EDT_FORWARD Action = "forward"
// EDT_EDIT tells the backend to forward the provided payload instead of the original one
EDT_EDIT = "edit"
// EDT_DROP tells the backend to create a dummy response and send it to the client.
// If a request is dropped it won't be forwarded to the server.
EDT_DROP = "drop"
// EDT_PROVIDERESP only has meaning if a request was intercepted. It allows to
// provide a response to the current request without forwarding it to the server.
EDT_PROVIDERESP = "provideResp"
//History actions
// HST_DUMP dumps the entire status, this is for debug purposes only
HST_DUMP = "dump"
// HST_FILTER allows to search and filter through history
HST_FILTER = "filter"
// HST_FETCH return the ReqResp given an ID
HST_FETCH = "fetch"
// HST_METADATA returns the metadata for the given ID
HST_METADATA = "metaData"
//Repeater actions
// RPT_CREATE Creates a new repeater entry
RPT_CREATE = "create"
// RPT_GO Performs the request
RPT_GO = "go"
// RPT_GET Retrieves an history item
RPT_GET = "get"
//Settings actions
// STN_INTERCEPT Gets (no params) or sets (param "ON") the intercept status
STN_INTERCEPT = "intercept"
)
const (
//Possible payloads types
// PLD_REQUEST should be used to tell the UI if the payload is a request
PLD_REQUEST = "request"
// PLD_RESPONSE should be used to tell the UI if the payload is a response
PLD_RESPONSE = "response"
)
// ArgName is the type of the set of Keys to use in the Args map of a command
type ArgName string
const (
// ARG_ID is used to identify which item of the collection should be fetched
ARG_ID ArgName = "id"
// ARG_SUBID is used to identify which item of the collection should be fetched.
// This is applied only if the resource identified by ID contains a collection.
ARG_SUBID = "subId"
// ARG_PAYLOADTYPE is used by editor to distinguish between requests and responses.
ARG_PAYLOADTYPE = "payloadType"
// ARG_ENDPOINT is used to refer to the host:port or schema://host:port
ARG_ENDPOINT = "endpoint"
// ARG_ERR is a value used to communicate an error occourred
ARG_ERR = "error"
// ARG_TLS is used as a bool to tell if ARG_TLS must be used for the specified operation
ARG_TLS = "tls"
// ARG_TRUE is used to deserialize a bool from a string.
ARG_TRUE = "true"
// ARG_FALSE is used to deserialize a bool from a string.
ARG_FALSE = ""
// ARG_ON is used as a key value for togglable settings
ARG_ON = "on"
)
// UIChannel is a string used to multiplex on the websocket and route commands
// to the proper packages
type UIChannel string
const (
// CHN_EDITOR channel used by intercept package, editor actions
CHN_EDITOR UIChannel = "proxy/intercept/editor"
// CHN_HISTORY channel used by intercept package, history actions
CHN_HISTORY = "proxy/httpHistory"
// CHN_REPEAT channel used by repeat package
CHN_REPEAT = "repeat"
// CHN_INTERCEPTSETTINGS channel used by intercept package, history actions
CHN_INTERCEPTSETTINGS = "proxy/intercept/options"
)