(ctx context.Context)
| 141 | } |
| 142 | |
| 143 | func (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. |
no test coverage detected