From f5028dc9da0bc5ebc33c0eaffddbf4b33c6a23da Mon Sep 17 00:00:00 2001 From: Aaron Coburn Date: Mon, 3 Aug 2020 14:22:15 -0400 Subject: [PATCH] Adjust content negotiation for binaries (#998) Resolves #997 --- .../java/org/trellisldp/http/impl/HttpUtils.java | 12 ++++++++---- .../java/org/trellisldp/http/impl/HttpUtilsTest.java | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java b/core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java index a7084b0f9..c20ad8f0f 100644 --- a/core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java +++ b/core/http/src/main/java/org/trellisldp/http/impl/HttpUtils.java @@ -192,11 +192,15 @@ public static RDFSyntax getSyntax(final IOService ioService, final List MediaType.valueOf(s.mediaType()).isCompatible(type)) .findFirst().orElse(null); diff --git a/core/http/src/test/java/org/trellisldp/http/impl/HttpUtilsTest.java b/core/http/src/test/java/org/trellisldp/http/impl/HttpUtilsTest.java index 208c5e3f4..7add93d68 100644 --- a/core/http/src/test/java/org/trellisldp/http/impl/HttpUtilsTest.java +++ b/core/http/src/test/java/org/trellisldp/http/impl/HttpUtilsTest.java @@ -98,6 +98,12 @@ void testGetSyntaxEmpty() { assertEquals(TURTLE, HttpUtils.getSyntax(ioService, emptyList(), null), "Turtle not default syntax!"); } + @Test + void testGetBinarySynax() { + assertNull(HttpUtils.getSyntax(ioService, asList(MediaType.TEXT_HTML_TYPE, MediaType.WILDCARD_TYPE), + "image/png"), "Incorrect binary syntax"); + } + @Test void testGetSyntaxFallback() { final List types = asList(APPLICATION_JSON_TYPE, TEXT_XML_TYPE,