If you're using "simple" sessions, you need to make sure you've only got one process since the cookies aren't shared between processes. That is, you probably got the cookie with one process and served the second request with another.

With the example in this tutorial, change the starman script to set the --workers to 1
 
http://perlmaven.com/getting-started-with-perl-dancer-on-digital-ocean

cheers

Andrew


On Wed, Oct 30, 2013 at 12:23 PM, Gabor Szabo <gabor@szabgab.com> wrote:
Hi there,

While testing an application I write in Dancer2 I was trying to
test the login mechanism. For this I need to send back the cookie
I received from the server. I have code like this:


my $r2 = dancer_response POST => '/login',
    params => {
             username => $users{username},
             password => $users{password},
      },
};

my ($cookie) =  $r2->header('set-cookie') =~ /(dancer.session=[^;]+);/;
diag $cookie;   #   dancer.session=UnD4WqseotQvyKMGxpoVXSUYRASXQ0TA


my $r3 = dancer_response GET => '/', {
    headers => [
           [ 'Cookie' => $cookie ],
    ],
 };


But the server responds to the second query as if the cookie
was not received by it.
The same works when using a regular browser.

What am I doing wrong?
What do I need to do in order for the  session cookie to be sent back?

regards
    Gabor
_______________________________________________
dancer-users mailing list
dancer-users@dancer.pm
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users