|
1 | 1 | package dev.openfeature.contrib.providers.gofeatureflag;
|
2 | 2 |
|
3 | 3 | import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
|
| 4 | + |
| 5 | +import com.fasterxml.jackson.databind.DeserializationFeature; |
4 | 6 | import com.fasterxml.jackson.databind.ObjectMapper;
|
5 | 7 | import com.fasterxml.jackson.databind.SerializationFeature;
|
6 | 8 | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
|
44 | 46 | public class GoFeatureFlagProvider implements FeatureProvider {
|
45 | 47 | private static final String NAME = "GO Feature Flag Provider";
|
46 | 48 | private static final ObjectMapper requestMapper = new ObjectMapper();
|
47 |
| - private static final ObjectMapper responseMapper = new ObjectMapper(); |
| 49 | + private static final ObjectMapper responseMapper = new ObjectMapper() |
| 50 | + .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
48 | 51 | private HttpUrl parsedEndpoint;
|
49 | 52 | // httpClient is the instance of the OkHttpClient used by the provider
|
50 | 53 | private OkHttpClient httpClient;
|
@@ -197,7 +200,10 @@ private <T> ProviderEvaluation<T> resolveEvaluationGoFeatureFlagProxy(
|
197 | 200 | if (Reason.DISABLED.name().equalsIgnoreCase(goffResp.getReason())) {
|
198 | 201 | // we don't set a variant since we are using the default value, and we are not able to know
|
199 | 202 | // which variant it is.
|
200 |
| - return ProviderEvaluation.<T>builder().value(defaultValue).reason(Reason.DISABLED.name()).build(); |
| 203 | + return ProviderEvaluation.<T>builder() |
| 204 | + .value(defaultValue) |
| 205 | + .variant(goffResp.getVariationType()) |
| 206 | + .reason(Reason.DISABLED.name()).build(); |
201 | 207 | }
|
202 | 208 |
|
203 | 209 | if (ErrorCode.FLAG_NOT_FOUND.name().equalsIgnoreCase(goffResp.getErrorCode())) {
|
|
0 commit comments