CalvinKirs commented on code in PR #7888:
URL: https://github.com/apache/geode/pull/7888#discussion_r1899399187


##########
geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java:
##########
@@ -65,8 +66,10 @@ protected String getRestApiVersion() {
   @ExceptionHandler({RegionNotFoundException.class, 
ResourceNotFoundException.class})
   @ResponseBody
   @ResponseStatus(HttpStatus.NOT_FOUND)
-  public String handle(final RuntimeException e) {
-    return convertErrorAsJson(e.getMessage());
+  public ResponseEntity<String> handle(final RuntimeException e) {
+    return ResponseEntity.status(HttpStatus.NOT_FOUND)
+        .contentType(APPLICATION_JSON_UTF8)
+        .body(convertErrorAsJson(e.getMessage()));
   }

Review Comment:
   Could we we globally set a default **Content-Type**  without having to 
specify it in each API?



##########
geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/BaseControllerAdvice.java:
##########
@@ -65,8 +66,10 @@ protected String getRestApiVersion() {
   @ExceptionHandler({RegionNotFoundException.class, 
ResourceNotFoundException.class})
   @ResponseBody
   @ResponseStatus(HttpStatus.NOT_FOUND)
-  public String handle(final RuntimeException e) {
-    return convertErrorAsJson(e.getMessage());
+  public ResponseEntity<String> handle(final RuntimeException e) {
+    return ResponseEntity.status(HttpStatus.NOT_FOUND)
+        .contentType(APPLICATION_JSON_UTF8)
+        .body(convertErrorAsJson(e.getMessage()));
   }

Review Comment:
   Couldwe globally set a default **Content-Type**  without having to specify 
it in each API?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to