MCPcopy
hub / github.com/docker/compose / FeatureFlags

Method FeatureFlags

internal/desktop/client.go:143–166  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

141}
142
143func (c *Client) FeatureFlags(ctx context.Context) (FeatureFlagResponse, error) {
144 req, err := c.newRequest(ctx, http.MethodGet, "/features", http.NoBody)
145 if err != nil {
146 return nil, err
147 }
148
149 resp, err := c.client.Do(req)
150 if err != nil {
151 return nil, err
152 }
153 defer func() {
154 _ = resp.Body.Close()
155 }()
156
157 if resp.StatusCode != http.StatusOK {
158 return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
159 }
160
161 var ret FeatureFlagResponse
162 if err := json.NewDecoder(resp.Body).Decode(&ret); err != nil {
163 return nil, err
164 }
165 return ret, nil
166}
167
168// IsFeatureEnabled checks the feature flag (GET /features) for a given
169// feature. Returns true when the feature is rolled out.

Callers 2

IsFeatureEnabledMethod · 0.95
LoadMethod · 0.80

Calls 2

newRequestMethod · 0.95
CloseMethod · 0.65

Tested by

no test coverage detected