Created
November 13, 2018 09:30
-
-
Save marcusramberg/cf02ba300e2dc0e8cf91334d68ed3cd3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Changes b/Changes | |
index b43c42d..0c6a1df 100644 | |
--- a/Changes | |
+++ b/Changes | |
@@ -1,5 +1,8 @@ | |
Revision history for perl distribution Mojolicious-Plugin-PromiseActions | |
+0.08 Not Released | |
+- Only render exception if a reply wasn't already rendered. | |
+ | |
0.07 2018-09-24T22:15:52+0200 | |
- Call wait on promise if it supports it | |
diff --git a/Makefile.PL b/Makefile.PL | |
index e0b0ecc..1166132 100644 | |
--- a/Makefile.PL | |
+++ b/Makefile.PL | |
@@ -14,7 +14,7 @@ my %WriteMakefileArgs = ( | |
} | |
, | |
PREREQ_PM => { | |
- 'Mojolicious' => '7.75', | |
+ 'Mojolicious' => '8.04', | |
'perl' => 'v5.10.0' | |
} | |
, | |
diff --git a/t/app.t b/t/app.t | |
index 65739d6..46a4936 100644 | |
--- a/t/app.t | |
+++ b/t/app.t | |
@@ -31,6 +31,27 @@ get '/normal' => sub { | |
$c->render(text=>'NO'); | |
return 1; | |
}; | |
+get '/reject' => sub { | |
+ my $c=shift; | |
+ my $p=Mojo::Promise->new; | |
+ Mojo::IOLoop->timer(0.1,sub { $p->reject('HI'); }); | |
+ $p->then(sub { | |
+ $c->render(text=>'Hello'); | |
+ }); | |
+ return $p; | |
+}; | |
+ | |
+get '/reject_rendered' => sub { | |
+ my $c=shift; | |
+ | |
+ my $p=Mojo::Promise->new; | |
+ Mojo::IOLoop->timer(0.1,sub { $p->reject('HI'); }); | |
+ $p->then(sub { | |
+ $c->render(text=>'Hello'); | |
+ }); | |
+ $c->reply->not_found; | |
+ return $p; | |
+}; | |
my $t=Test::Mojo->new; | |
$t->get_ok('/')->status_is('200')->content_is('Hello'); | |
@@ -39,6 +60,8 @@ is($values[1],'hello', 'Second argument passed through ok'); | |
$t->get_ok('/normal')->status_is('200')->content_is('NO'); | |
is($values[2],'1', 'Got return'); | |
is($values[3],undef, 'No second argument'); | |
+$t->get_ok('/reject')->status_is('500'); | |
+$t->get_ok('/reject_rendered')->status_is('404'); | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment