KES777 / mojo

Mojolicious - Perl real-time web framework
http://mojolicio.us
Artistic License 2.0
0 stars 0 forks source link

Session is broken when exception occur #24

Open KES777 opened 6 years ago

KES777 commented 6 years ago

When exception occur the session is broken. Refreshing this page will redo an action with broken session.

How to reproduce: generate app and apply this patch: ```diff --- a/lib/MyApp/Controller/Example.pm +++ b/lib/MyApp/Controller/Example.pm @@ -5,6 +5,14 @@ use Mojo::Base 'Mojolicious::Controller'; sub welcome { my $self = shift; + my $s = $self->session; + + $s->{ incomplete_data }++; + die "Redo the action - refresh page. " .$s->{ incomplete_data }; + + delete $s->{ incomplete_data }; + $s->{ done } = 1; + # Render template "example/welcome.html.ep" with message $self->render(msg => 'Welcome to the Mojolicious real-time web framework!'); } ``` How to repeat first request with the same session data? (or: how to prevent cookie update when exception occur: https://metacpan.org/source/SRI/Mojolicious-7.70/lib/Mojolicious/Controller.pm#L213)