(t *testing.T, sc *ServerContext, method, path, body string, headers map[string]string)
| 113 | } |
| 114 | |
| 115 | func 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 | |
| 145 | func doBootstrapRequest(t *testing.T, sc *ServerContext, method, path, body string, headers map[string]string, server serverType) boostrapResponse { |
| 146 | host := "http://" + mustGetServerAddr(t, sc, server) |
no test coverage detected