From 752c41128b4c9cf2bda586da14fae0052b63b81d Mon Sep 17 00:00:00 2001 From: Aaron Klish Date: Sat, 11 Feb 2023 14:15:31 -0600 Subject: [PATCH] Fixes #2789 (#2880) * Fixes #2789 * Added space to test build fix * Another test * Another test --- .../elide/core/utils/coerce/converters/Serde.java | 1 + .../elide/spring/controllers/JsonApiController.java | 2 +- .../src/test/java/example/tests/ControllerTest.java | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/elide-core/src/main/java/com/yahoo/elide/core/utils/coerce/converters/Serde.java b/elide-core/src/main/java/com/yahoo/elide/core/utils/coerce/converters/Serde.java index daf0fb4bf7..aab83974a9 100644 --- a/elide-core/src/main/java/com/yahoo/elide/core/utils/coerce/converters/Serde.java +++ b/elide-core/src/main/java/com/yahoo/elide/core/utils/coerce/converters/Serde.java @@ -11,6 +11,7 @@ * @param The deserialized type */ public interface Serde { + /** * Deserialize an instance of type S to type T. * @param val The thing to deserialize diff --git a/elide-spring/elide-spring-boot-autoconfigure/src/main/java/com/yahoo/elide/spring/controllers/JsonApiController.java b/elide-spring/elide-spring-boot-autoconfigure/src/main/java/com/yahoo/elide/spring/controllers/JsonApiController.java index 0644b87ac8..6a696e6c7f 100644 --- a/elide-spring/elide-spring-boot-autoconfigure/src/main/java/com/yahoo/elide/spring/controllers/JsonApiController.java +++ b/elide-spring/elide-spring-boot-autoconfigure/src/main/java/com/yahoo/elide/spring/controllers/JsonApiController.java @@ -146,7 +146,7 @@ public ResponseEntity call() throws Exception { }; } - @DeleteMapping(value = "/**") + @DeleteMapping(value = "/**", produces = JSON_API_CONTENT_TYPE) public Callable> elideDelete(@RequestHeader HttpHeaders requestHeaders, @RequestParam MultiValueMap allRequestParams, HttpServletRequest request, diff --git a/elide-spring/elide-spring-boot-autoconfigure/src/test/java/example/tests/ControllerTest.java b/elide-spring/elide-spring-boot-autoconfigure/src/test/java/example/tests/ControllerTest.java index 0b71d85405..8047f164df 100644 --- a/elide-spring/elide-spring-boot-autoconfigure/src/test/java/example/tests/ControllerTest.java +++ b/elide-spring/elide-spring-boot-autoconfigure/src/test/java/example/tests/ControllerTest.java @@ -282,6 +282,18 @@ public void jsonApiDeleteTest() { .statusCode(HttpStatus.SC_NO_CONTENT); } + /** + * Function to verify the content type of a HTTP Delete error request. + */ + @Test + public void jsonApiDeleteErrorTest() { + when() + .delete("/json/group/doestnotexist") + .then() + .contentType(JsonApiController.JSON_API_CONTENT_TYPE) + .statusCode(HttpStatus.SC_NOT_FOUND); + } + @Test @Sql(statements = { "INSERT INTO ArtifactProduct (name, commonName, description, group_name) VALUES\n"