Session is not shared between requests using Snaplet.Session

拈花ヽ惹草 提交于 2019-12-11 10:28:02

问题


A simple example of Snaplet and Session here

$ curl http://localhost:8000/sessioin -d "key=k&value=v"
k
getter

$ curl http://localhost:8000/sessioin

getter

I cannot get session in the 2nd request.


回答1:


Depending on your definition of with, you probably forgot to commit your session after you set values in it.

Also, you're using curl to test this system. curl doesn't preserve cookies by default, which is why your session cookie is lost. Try using this (works on my machine):

curl -c cookies.txt http://localhost:8000/session -d "key=k&value=v"
curl -b cookies.txt http://localhost:8000/session

See also the revised answer to your previous question.



来源:https://stackoverflow.com/questions/8487206/session-is-not-shared-between-requests-using-snaplet-session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!