Skip to content

Conversation

mmanciop
Copy link

@mmanciop mmanciop commented Oct 9, 2018

This commit adds support for @ResponseStatus in DefaultErrorAttributes
mimicking the semantics of @ResponseStatus in SpringMVC.

Throwables annotated with @ResponseStatus handled by
DefaultErrorAttributes will result in the following error attributes:

  • 'status' set as the return value of the HttpStatus#value()
    defined as @ResponseStatus#value()
  • 'error' set to the default reason phrase of the HttpStatus
    defined as @ResponseStatus#value()
  • 'message' defined as the value of @ResponseStatus#reason(),
    or the default HttpStatus's reason phrase if left unspecified

Fixes #14742

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 9, 2018
This commit adds support for @ResponseStatus in DefaultErrorAttributes
mimiching the semantics of @ResponseStatus in SpringMVC.

Throwables annotated with @ResponseStatus handled by
DefaultErrorAttributes will result in the following error attributes:
* 'status' set as the return value of the HttpStatus#value()
  defined as @ResponseStatus#value()
* 'error' set to the default reason phrase of the HttpStatus
  defined as @ResponseStatus#value()
* 'message' defined as the value of @ResponseStatus#reason(),
  or the default HttpStatus's reason phrase if left unspecified

Fixes spring-projects#14742
@mmanciop mmanciop force-pushed the webflux-reason-status branch from 892df56 to 93f9d6f Compare October 9, 2018 19:54
@bclozel bclozel added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 10, 2018
@bclozel bclozel added this to the 2.0.x milestone Oct 10, 2018
@wilkinsona wilkinsona changed the title Add support for @ResponseStatus in DefaultErrorAttributes @ResponseStatus does not work when using WebFlux Oct 10, 2018
@philwebb philwebb modified the milestones: 2.0.x, 2.0.6 Oct 10, 2018
@snicoll snicoll self-assigned this Oct 12, 2018
snicoll pushed a commit that referenced this pull request Oct 12, 2018
This commit adds support for @ResponseStatus in DefaultErrorAttributes
mimicking the semantics of @ResponseStatus in SpringMVC.

Throwables annotated with @ResponseStatus handled by
DefaultErrorAttributes will result in the following error attributes:
* 'status' set as the return value of the HttpStatus#value()
  defined as @ResponseStatus#value()
* 'error' set to the default reason phrase of the HttpStatus
  defined as @ResponseStatus#value()
* 'message' defined as the value of @ResponseStatus#reason(),
  or the default HttpStatus's reason phrase if left unspecified

See gh-14744
snicoll added a commit that referenced this pull request Oct 12, 2018
* pr/14744:
  Polish "Add support for @ResponseStatus in DefaultErrorAttributes"
  Add support for @ResponseStatus in DefaultErrorAttributes
@snicoll snicoll closed this in 798b378 Oct 12, 2018
@snicoll
Copy link
Member

snicoll commented Oct 12, 2018

@mmanciop thank you for making your first contribution to Spring Boot. This is merged in 2.0.x and master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebFlux: @ResponseStatus does not work out of the box, but ResponseStatusException does
6 participants