diff --git a/src/main/java/org/edgegallery/mecm/apm/apihandler/filter/JsonRequestSizeLimitFilter.java b/src/main/java/org/edgegallery/mecm/apm/apihandler/filter/JsonRequestSizeLimitFilter.java index 4746dbcbb8d15ffe87251ea5ca370def1198b765..a3f122f399d09a4a87a2e467cbdad7e5e26b6607 100644 --- a/src/main/java/org/edgegallery/mecm/apm/apihandler/filter/JsonRequestSizeLimitFilter.java +++ b/src/main/java/org/edgegallery/mecm/apm/apihandler/filter/JsonRequestSizeLimitFilter.java @@ -51,7 +51,10 @@ public class JsonRequestSizeLimitFilter extends OncePerRequestFilter { } private boolean isApplicationJson(HttpServletRequest httpRequest) { - return MediaType.APPLICATION_JSON.isCompatibleWith(MediaType - .parseMediaType(httpRequest.getHeader(HttpHeaders.CONTENT_TYPE))); + if (httpRequest.getHeader(HttpHeaders.CONTENT_TYPE) != null) { + return MediaType.APPLICATION_JSON.isCompatibleWith(MediaType + .parseMediaType(httpRequest.getHeader(HttpHeaders.CONTENT_TYPE))); + } + return false; } }