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.
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: