public static InputPart getRequiredPart(@NotNull MultipartFormDataInput formDataInput, @NotNull String partName, @NotNull MediaType mediaType) {
        Map<String, List<InputPart>> formData = formDataInput.getFormDataMap();
        return Optional.ofNullable(formData.get(partName))
                .filter(parts -> !parts.isEmpty())
                .map(parts -> parts.get(0))
                .filter(part -> part.getMediaType().isCompatible(mediaType))
                .orElseThrow(() -> new IllegalArgumentException("Must provide '" + partName + "' with Content-Type: " + mediaType));
    }
@author Marc Savy {@literal <marc@blackparrotlabs.io>}
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/MultipartHelper.java