Plack-Middleware-CookieMonster

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.03 2014-12-13T12:38:25Z
    - Add ability to expire cookie that sit on a path

0.02 Wed Feb 19 11:31:00 GMT 2014
    - Fixed embarassing bug triggered by streaming responses

0.01 Tue Feb 18 10:33:24 GMT 2014
    - initial release

t/Plack/Middleware/CookieMonster.t  view on Meta::CPAN

            die 'oopsie';
        }

        return [
            200, [ 'Content-Type' => 'text/html', 'Set-Cookie', 'sessionid=2345678' ],
            ['<body>Hello World</body>']
        ];
    };
}

sub _get_streaming_app {
    return sub {
        my $env = shift;

        return sub {
            my $respond = shift;
            if ( $env->{ PATH_INFO } ne '/nocrash' ) {
                eval { require DooBar };
            }
            $respond->(
                [
                    200,
                    [ 'Content-Type' => 'text/html', 'Set-Cookie', 'sessionid=2345678' ],
                    [ '<body>Hello World</body>' ]
                ]
            );
        };
    };
}

sub test_no_stacktrace {
    foreach my $inner_app ( _get_app, _get_streaming_app ) {
        my $app = builder {
            enable 'StackTrace';
            $inner_app;
        };

        test_psgi $app, sub {
            my $cb  = shift;
            my $res = $cb->( GET '/nocrash', 'Cookie' => 'sessionid=1234567' );
            is $res->code, 200, 'response status 200';
            is $res->header( 'Set-Cookie' ), 'sessionid=2345678', 'app sets a cookie';



( run in 0.267 second using v1.01-cache-2.11-cpan-4d50c553e7e )