How to get session's cookie string

Hi,everyone!
I have a problem:
After using session[:foo]=foo change my session, I want to know what
the new “session_key” cookie value would be before I response. I tried
session.to_s and session.encode but didn’t work.
Thanks in advance:-)