spring-session icon indicating copy to clipboard operation
spring-session copied to clipboard

Fix session cookie writes for string responses

Open Sanjay44NS opened this issue 6 months ago • 0 comments

Summary

  • fix OnCommittedResponseWrapper so 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 String response writes the SESSION cookie

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"

Sanjay44NS avatar May 21 '26 10:05 Sanjay44NS