cloudAdminReq is a small helper that builds a request with optional JSON body and the caller-chosen headers.
(t *testing.T, method, path string, body interface{}, headers map[string]string)
| 17 | // cloudAdminReq is a small helper that builds a request with optional JSON body |
| 18 | // and the caller-chosen headers. |
| 19 | func cloudAdminReq(t *testing.T, method, path string, body interface{}, headers map[string]string) *http.Request { |
| 20 | t.Helper() |
| 21 | var r io.Reader |
| 22 | if body != nil { |
| 23 | b, _ := json.Marshal(body) |
| 24 | r = bytes.NewReader(b) |
| 25 | } |
| 26 | req := httptest.NewRequest(method, path, r) |
| 27 | if body != nil { |
| 28 | req.Header.Set("Content-Type", "application/json") |
| 29 | } |
| 30 | req.RemoteAddr = "192.0.2.1:1" |
| 31 | for k, v := range headers { |
| 32 | req.Header.Set(k, v) |
| 33 | } |
| 34 | return req |
| 35 | } |
| 36 | |
| 37 | // TestCloudAdminGate_SelfHost_Returns404 verifies the cloud-admin endpoints |
| 38 | // disappear entirely when the server isn't in cloud mode — no "cloud mode |
no test coverage detected