WebFlux commitActions are called after status, headers and cookies are set [SPR-16597] #21138
Comments
Nicolas Portmann commented It looks as if this behavioral change was introduced in 9f8e845 |
Rossen Stoyanchev commented Well spotted, thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nicolas Portmann opened SPR-16597 and commented
ServerHttpResponse allows commitActions to be added (e.g. inside a WebFilter) via the beforeCommit method.
AbstractHttpServerResponse however calls the protected methods applyStatusCode(), applyHeaders() and applyCookies() synchronously before the Mono<Void>s passed as commitActions get executed. This makes it impossible to change the status code, add headers or cookies in beforeCommit actions asynchonously. A use case for this would be to add values from the subscriber context to the response headers.
AbstractHttpServerResponse#doCommit should wrap the calls to the applyXXX() methods in a mono which is subscribed to after the other commitActions.
Current code:
Proposed solution:
Affects: 5.0.4
Issue Links:
Referenced from: commits 72bbb26
The text was updated successfully, but these errors were encountered: