Skip to content

Write ResponseStatusException headers in WebFlux error responses#50934

Open
U-S-jun wants to merge 1 commit into
spring-projects:mainfrom
U-S-jun:fix-gh-18831-webflux-error-response-headers
Open

Write ResponseStatusException headers in WebFlux error responses#50934
U-S-jun wants to merge 1 commit into
spring-projects:mainfrom
U-S-jun:fix-gh-18831-webflux-error-response-headers

Conversation

@U-S-jun

@U-S-jun U-S-jun commented Jul 13, 2026

Copy link
Copy Markdown

AbstractErrorWebExceptionHandler renders a ResponseStatusException before
Spring Framework's ResponseStatusExceptionHandler can apply its response
headers. As a result, exception-contributed headers such as Allow on a 405
response are lost.

This change applies headers contributed by a direct ResponseStatusException
before writing the generated ServerResponse, matching Spring Framework's
existing behavior. It deliberately leaves the broader error-handling
infrastructure unchanged.

Closes gh-18831

Tests:

  • DefaultErrorWebExceptionHandlerIntegrationTests.responseStatusExceptionHeaders
  • :module:spring-boot-webflux:test
  • checkFormatMain, checkFormatTest, checkstyleMain, and checkstyleTest
  • git diff --check

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 13, 2026
@U-S-jun U-S-jun marked this pull request as ready for review July 13, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Write HTTP response headers contributed by exceptions in WebFlux error handling

2 participants