Light, fluffy, and always free - The AWS Local Emulator alternative
Fix crash when request Content-Type header is empty string (#940)
Mike Manginoc6928128ffde
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/ServiceEnabledFilter.java b/src/main/java/io/github/hectorvent/floci/core/common/ServiceEnabledFilter.javaindex 53b27f26ab..6e55bb5c76 100644--- a/src/main/java/io/github/hectorvent/floci/core/common/ServiceEnabledFilter.java+++ b/src/main/java/io/github/hectorvent/floci/core/common/ServiceEnabledFilter.java@@ -76,7 +76,9 @@ public class ServiceEnabledFilter implements ContainerRequestFilter {}private java.util.Optional<ServiceProtocol> inferProtocol(ContainerRequestContext ctx) {- String contentType = ctx.getMediaType() != null ? ctx.getMediaType().toString() : "";+ // Use the raw header string to avoid IllegalArgumentException when Content-Type is empty.+ String contentType = ctx.getHeaderString("Content-Type");+ if (contentType == null) contentType = "";if (contentType.contains("cbor")) {return java.util.Optional.of(ServiceProtocol.CBOR);}