spring-session
spring-session copied to clipboard
Fix session cookie writes for string responses
Summary
- fix
OnCommittedResponseWrapperso Spring Session commits once an explicitly zero content-length response performs a body write - add core regressions for string and empty-body cases that previously missed the early session commit path
- include JDBC and Redis sample checks as proof-of-concept verification that a plain
Stringresponse writes theSESSIONcookie
Fixes #3755
Notes
- the main fix is isolated to
spring-session-core - the sample changes are included only as additional verification of the reported behavior
- if you would prefer to keep the PR scoped to the core fix and regressions, I can drop the sample changes
Testing
- [x]
.\gradlew.bat :spring-session-core:test --tests "org.springframework.session.web.http.OnCommittedResponseWrapperTests" --tests "org.springframework.session.web.http.SessionRepositoryFilterTests" - [x]
.\gradlew.bat :spring-session-core:build - [x]
.\gradlew.bat :spring-session-sample-boot-jdbc:integrationTest --tests "sample.BootTests.stringResponseSetsSessionCookie" - [x]
.\gradlew.bat :spring-session-sample-boot-redis:integrationTest --tests "sample.BootTests.stringResponseSetsSessionCookie"