Session is not shared between requests using Snapl

2019-08-11 07: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条回答
迷人小祖宗
2楼-- · 2019-08-11 07:49

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.

查看更多
登录 后发表回答