(path string, payload any)
| 174 | } |
| 175 | |
| 176 | func postJSON(path string, payload any) (int, []byte) { |
| 177 | GinkgoHelper() |
| 178 | data, err := json.Marshal(payload) |
| 179 | Expect(err).NotTo(HaveOccurred()) |
| 180 | httpResp, err := http.Post(anthropicBaseURL+path, "application/json", bytes.NewReader(data)) |
| 181 | Expect(err).NotTo(HaveOccurred()) |
| 182 | defer func() { _ = httpResp.Body.Close() }() |
| 183 | body, err := io.ReadAll(httpResp.Body) |
| 184 | Expect(err).NotTo(HaveOccurred()) |
| 185 | return httpResp.StatusCode, body |
| 186 | } |