You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When sending multiple links to a one-to-one or many-to-one association, the server responds with 500 Internal server error due to the RepositoryPropertyReferenceController throwing an IllegalArgumentException (message: "Must send only 1 link to update a property reference that isn't a List or a Map."). Since a general IllegalArgumentException is thrown, this results in a HTTP 500 error from
.
Typically, the response for an error triggered by user input would be in the 4xx range, e.g. 400 Bad Request.
If a more specific exception was thrown, it could be handled by the ExceptionHandler to return a more correct HTTP error, and developers that integrate spring-data-rest can supply their own @ExceptionHandler to handle this error as well.
The text was updated successfully, but these errors were encountered:
NielsCW
changed the title
Sending multiple links to a *-to-one association should respond with 400 Bad request
Sending multiple links to a *-to-one association responds with 500 Internal Server Error
Jul 10, 2024
When sending multiple links to a one-to-one or many-to-one association, the server responds with 500 Internal server error due to the
RepositoryPropertyReferenceController
throwing an IllegalArgumentException (message:"Must send only 1 link to update a property reference that isn't a List or a Map."
). Since a generalIllegalArgumentException
is thrown, this results in a HTTP 500 error fromspring-data-rest/spring-data-rest-webmvc/src/main/java/org/springframework/data/rest/webmvc/RepositoryRestExceptionHandler.java
Lines 88 to 99 in aaadc34
Typically, the response for an error triggered by user input would be in the 4xx range, e.g. 400 Bad Request.
If a more specific exception was thrown, it could be handled by the
ExceptionHandler
to return a more correct HTTP error, and developers that integrate spring-data-rest can supply their own@ExceptionHandler
to handle this error as well.The text was updated successfully, but these errors were encountered: