MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / getAndDecode

Function getAndDecode

controller/uptime_kuma.go:37–54  ·  view source on GitHub ↗
(ctx context.Context, client *http.Client, url string, dest interface{})

Source from the content-addressed store, hash-verified

35}
36
37func getAndDecode(ctx context.Context, client *http.Client, url string, dest interface{}) error {
38 req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
39 if err != nil {
40 return err
41 }
42
43 resp, err := client.Do(req)
44 if err != nil {
45 return err
46 }
47 defer resp.Body.Close()
48
49 if resp.StatusCode != http.StatusOK {
50 return errors.New("non-200 status")
51 }
52
53 return json.NewDecoder(resp.Body).Decode(dest)
54}
55
56func fetchGroupData(ctx context.Context, client *http.Client, groupConfig map[string]interface{}) UptimeGroupResult {
57 url, _ := groupConfig["url"].(string)

Callers 1

fetchGroupDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected