spring-projects / spring-projects/spring-data-rest
Sending invalid links payload to relationship results in 500 [DATAREST-586]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Etki opened DATAREST-586 and commented
Hi.
It seems that malformed links payload may cause an IllegalStateException which, in turn, forces controller to return HTTP error 500 status.
Imagine that i'm dumb enough to not to read HAL spec and sending something like this to relationship endpoint:
{
"id": 1
}
This will force controller to raise IllegalStateException, which is caught by exception handler that returns null accompanied by HttpStatus.InternalServerError. I guess that this particular exception has to be treated as 400 bad request, and probably another class should be used instead of IllegalStateException.
If you're too busy to deal with it, i can try to come up with pull request this or next weekend (i'm new to java, so i'm not 100% sure i'll do everything correct and not sure i'll do it fast)
Affects: 2.3 GA (Fowler)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.