MCPcopy Index your code
hub / github.com/SpectoLabs/hoverfly / GetMode

Function GetMode

hoverctl/wrapper/mode.go:12–33  ·  view source on GitHub ↗

GetMode will go the state endpoint in Hoverfly, parse the JSON response and return the mode of Hoverfly

(target configuration.Target)

Source from the content-addressed store, hash-verified

10
11// GetMode will go the state endpoint in Hoverfly, parse the JSON response and return the mode of Hoverfly
12func GetMode(target configuration.Target) (*v2.ModeView, error) {
13 response, err := doRequest(target, "GET", v2ApiMode, "", nil)
14 if err != nil {
15 return nil, err
16 }
17
18 defer response.Body.Close()
19
20 err = handleResponseError(response, "Could not retrieve mode")
21 if err != nil {
22 return nil, err
23 }
24
25 var modeView v2.ModeView
26
27 err = UnmarshalToInterface(response, &modeView)
28 if err != nil {
29 return nil, err
30 }
31
32 return &modeView, nil
33}
34
35// Set will go the state endpoint in Hoverfly, sending JSON that will set the mode of Hoverfly
36func SetModeWithArguments(target configuration.Target, modeView *v2.ModeView) (string, error) {

Calls 3

handleResponseErrorFunction · 0.85
UnmarshalToInterfaceFunction · 0.85
doRequestFunction · 0.70