MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / doBootstrapAdminRequest

Function doBootstrapAdminRequest

rest/utilities_testing_bootstrap.go:115–143  ·  view source on GitHub ↗
(t *testing.T, sc *ServerContext, method, path, body string, headers map[string]string)

Source from the content-addressed store, hash-verified

113}
114
115func doBootstrapAdminRequest(t *testing.T, sc *ServerContext, method, path, body string, headers map[string]string) boostrapResponse {
116 host := "http://" + mustGetServerAddr(t, sc, adminServer)
117 url := host + path
118
119 buf := bytes.NewBufferString(body)
120 req, err := http.NewRequest(method, url, buf)
121 require.NoError(t, err)
122
123 for headerName, headerVal := range headers {
124 req.Header.Set(headerName, headerVal)
125 }
126
127 resp, err := http.DefaultClient.Do(req)
128 require.NoError(t, err)
129
130 defer func() {
131 assert.NoError(t, resp.Body.Close())
132 }()
133
134 rBody, err := io.ReadAll(resp.Body)
135 require.NoError(t, err)
136
137 return boostrapResponse{
138 response: resp,
139 t: t,
140 url: method + " " + url,
141 Body: string(rBody),
142 }
143}
144
145func doBootstrapRequest(t *testing.T, sc *ServerContext, method, path, body string, headers map[string]string, server serverType) boostrapResponse {
146 host := "http://" + mustGetServerAddr(t, sc, server)

Callers 2

BootstrapAdminRequestFunction · 0.85

Calls 3

mustGetServerAddrFunction · 0.85
CloseMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected