diff --git a/backend/src/main/java/com/festago/presentation/GlobalExceptionHandler.java b/backend/src/main/java/com/festago/presentation/GlobalExceptionHandler.java index 866b119cc..1df4a7d82 100644 --- a/backend/src/main/java/com/festago/presentation/GlobalExceptionHandler.java +++ b/backend/src/main/java/com/festago/presentation/GlobalExceptionHandler.java @@ -13,6 +13,7 @@ import org.slf4j.Logger; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.InvalidMediaTypeException; import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.MethodArgumentNotValidException; @@ -59,6 +60,11 @@ public GlobalExceptionHandler(AuthenticateContext authenticateContext, Logger er this.errorLogger = errorLogger; } + @ExceptionHandler(InvalidMediaTypeException.class) + public ResponseEntity handle(InvalidMediaTypeException e) { + return ResponseEntity.badRequest().build(); + } + @ExceptionHandler(BadRequestException.class) public ResponseEntity handle(BadRequestException e, HttpServletRequest request) { logInfo(e, request);