(t *testing.T, method, url, bearer string, body any)
| 8 | ) |
| 9 | |
| 10 | func sendJSON(t *testing.T, method, url, bearer string, body any) (int, map[string]any) { |
| 11 | t.Helper() |
| 12 | b, _ := json.Marshal(body) |
| 13 | req, _ := http.NewRequest(method, url, bytes.NewReader(b)) |
| 14 | req.Header.Set("Content-Type", "application/json") |
| 15 | if bearer != "" { |
| 16 | req.Header.Set("Authorization", "Bearer "+bearer) |
| 17 | } |
| 18 | resp, err := http.DefaultClient.Do(req) |
| 19 | if err != nil { |
| 20 | t.Fatal(err) |
| 21 | } |
| 22 | defer resp.Body.Close() |
| 23 | var out map[string]any |
| 24 | _ = json.NewDecoder(resp.Body).Decode(&out) |
| 25 | return resp.StatusCode, out |
| 26 | } |
| 27 | |
| 28 | // TestUpdateAgentName exercises the post-reshape agent PATCH: the only mutable |
| 29 | // field is the display name (screening config moved to /protection). |
no test coverage detected