fix image error responses
This commit is contained in:
@@ -5,6 +5,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.data.core.PropertyReferenceException;
|
import org.springframework.data.core.PropertyReferenceException;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.FieldError;
|
import org.springframework.validation.FieldError;
|
||||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
@@ -118,7 +119,9 @@ public class GlobalExceptionHandler {
|
|||||||
request.getRequestURI(),
|
request.getRequestURI(),
|
||||||
LocalDateTime.now()
|
LocalDateTime.now()
|
||||||
);
|
);
|
||||||
return ResponseEntity.status(status).body(error);
|
return ResponseEntity.status(status)
|
||||||
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
|
.body(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildDetails(Exception ex) {
|
private String buildDetails(Exception ex) {
|
||||||
|
|||||||
Reference in New Issue
Block a user