Skip to content

Commit 6859fa6

Browse files
fix(gofeatureflag): fix java.lang.NoClassDefFoundError (#839)
Signed-off-by: Thomas Poignant <[email protected]>
1 parent 52bfdfe commit 6859fa6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

providers/go-feature-flag/src/main/java/dev/openfeature/contrib/providers/gofeatureflag/controller/GoFeatureFlagController.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import java.util.concurrent.TimeUnit;
4646

4747
import static dev.openfeature.sdk.Value.objectToValue;
48-
import static org.apache.hc.core5.http.ContentType.APPLICATION_JSON;
48+
4949

5050
/**
5151
* GoFeatureFlagController is the layer to contact the APIs and get the data
@@ -54,6 +54,7 @@
5454
@Slf4j
5555
@SuppressWarnings({"checkstyle:NoFinalizer"})
5656
public class GoFeatureFlagController {
57+
public static final String APPLICATION_JSON = "application/json";
5758
public static final ObjectMapper requestMapper = new ObjectMapper();
5859
private static final ObjectMapper responseMapper = new ObjectMapper()
5960
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -136,7 +137,7 @@ public <T> EvaluationResponse<T> evaluateFlag(
136137

137138
Request.Builder reqBuilder = new Request.Builder()
138139
.url(url)
139-
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.getMimeType())
140+
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON)
140141
.post(RequestBody.create(
141142
requestMapper.writeValueAsBytes(goffRequest),
142143
MediaType.get("application/json; charset=utf-8")));
@@ -215,7 +216,7 @@ public void sendEventToDataCollector(List<Event> eventsList) {
215216

216217
Request.Builder reqBuilder = new Request.Builder()
217218
.url(url)
218-
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.getMimeType())
219+
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON)
219220
.post(RequestBody.create(
220221
requestMapper.writeValueAsBytes(events),
221222
MediaType.get("application/json; charset=utf-8")));
@@ -258,7 +259,7 @@ public ConfigurationChange configurationHasChanged() throws GoFeatureFlagExcepti
258259

259260
Request.Builder reqBuilder = new Request.Builder()
260261
.url(url)
261-
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON.getMimeType())
262+
.addHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON)
262263
.get();
263264

264265
if (this.etag != null && !this.etag.isEmpty()) {

0 commit comments

Comments
 (0)