spring-projects / spring-projects/spring-data-rest

Spring Data REST association resource always returns HTTP status 204 even if entity being linked is invalid [DATAREST-1296]

Open
#1,616 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Alegria Aclan opened DATAREST-1296 and commented

Actual Behavior:

Doing the ff invalid requests always returns HTTP 204 status

  • invalid text

 curl -X PUT -H "Content-Type: text/uri-list" -d "invalid text" http://localhost:8080/persons/1/addresses 

  • empty payload

 curl -X PUT -H "Content-Type: text/uri-list" http://localhost:8080/persons/1/addresses 

  • valid resource url but not referencing a specific entity

 curl -X PUT -H "Content-Type: text/uri-list" -d "``http://localhost:8080/addresses``" http://localhost:8080/persons/1/addresses 

  • invalid resource url

 curl -X PUT -H "Content-Type: text/uri-list" -d "``http://localhost:8080/addresses/nonexistingid``" http://localhost:8080/persons/1/addresses 

Expected Behavior:

Must return HTTP 400 error instead


1 votes, 1 watchers

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.