eugenp/REST — Issue #3: ResponseStatus annotation, reason field doesn't propagate to HTTP response
Author: briane
Created: 2012-02-10 12:31:47+00:00
State: open

When setting the reason in @ResponseStatus, the reason is not propagated in the HTTP response. I modified the latest version of the project as follows:

Modified the following line in ConflictException.java (added reason):
@ResponseStatus(value = HttpStatus.CONFLICT, reason = "ConflictExceptionReason")

Set breakpoint in UserLogicRESTIntegrationTest.java at method whenUserIsCreatedWithNewRole_then409IsReceived at the response and don't see the reason changed. It is "HTTP/1.1 409 Conflict" and would expect "HTTP/1.1 409 ConflictExceptionReason".

There is another Github project that just does a minimal RESTful service in MVC and demonstrates use of the reason, so I don't think it's a Spring issue. Most likely just a project configuration issue:
github.com/Zenika/Blogs/tree/master/20110518_REST-error-handling/rest-error-handling