Skip to content

Document response body negotiation for PUT and POST requests via Accept header #2063

Closed
@mjustin

Description

@mjustin

When doing some integration testing, I discovered the hard way that unless configured otherwise, PUT & POST only return a response body when the HTTP Accept header is set (due to #418). My regular calls apparently set the headers but it took me some time, digging through code, and some web searching to figure out why my integration test was not seeing a response body.

Looking into the reference guide, I see almost no mention of this behavior. The only reference is in 4.1.2. Default Status Codes, where it refers to the status code (but not the response body):

If the configuration values (RepositoryRestConfiguration.returnBodyOnUpdate and RepositoryRestConfiguration.returnBodyCreate) are explicitly set to null, the presence of the HTTP Accept header is used to determine the response code.

I think it would be beneficial if the response body behavior were more explicitly documented. In particular, it would be helpful if the reference guide called out that the presence of a response body is dependent on the accept header unless configured otherwise.

Incidentally, I think this Stack Overflow user likewise ended up getting bitten by this exact same piece of behavior, so I don't think it's just me who's had to track down this mostly undocumented behavior.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions