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

Function ExportSimulation

hoverctl/wrapper/simulation.go:13–33  ·  view source on GitHub ↗
(target configuration.Target, urlPattern string)

Source from the content-addressed store, hash-verified

11)
12
13func ExportSimulation(target configuration.Target, urlPattern string) (v2.SimulationViewV5, error) {
14 view := v2.SimulationViewV5{}
15 requestUrl := v2ApiSimulation
16 if len(urlPattern) > 0 {
17 requestUrl = fmt.Sprintf("%s?urlPattern=%s", requestUrl, url.QueryEscape(urlPattern))
18 }
19 response, err := doRequest(target, "GET", requestUrl, "", nil)
20 if err != nil {
21 return view, err
22 }
23
24 defer response.Body.Close()
25
26 err = handleResponseError(response, "Could not retrieve simulation")
27 if err != nil {
28 return view, err
29 }
30
31 err = json.NewDecoder(response.Body).Decode(&view)
32 return view, err
33}
34
35func ImportSimulation(target configuration.Target, simulationData string) error {
36 response, err := doRequest(target, "PUT", v2ApiSimulation, simulationData, nil)

Calls 2

handleResponseErrorFunction · 0.85
doRequestFunction · 0.70