MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / cloudAdminReq

Function cloudAdminReq

internal/server/cloud_admin_gate_test.go:19–35  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

17// cloudAdminReq is a small helper that builds a request with optional JSON body
18// and the caller-chosen headers.
19func 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

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected