Redirect for old /thread/post
path
This commit is contained in:
parent
18634bbf60
commit
decbc120e3
|
@ -61,7 +61,6 @@ tests locally:
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
- Redirect for `/thread/post`
|
|
||||||
- Implement [CSRF](https://docs.mojolicious.org/Mojolicious/Guides/Rendering#Cross-site-request-forgery)
|
- Implement [CSRF](https://docs.mojolicious.org/Mojolicious/Guides/Rendering#Cross-site-request-forgery)
|
||||||
- Tripcodes/PGP signing somehow perhaps...
|
- Tripcodes/PGP signing somehow perhaps...
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,11 @@ sub startup($self) {
|
||||||
->to('thread#flag')
|
->to('thread#flag')
|
||||||
->name('flag_thread');
|
->name('flag_thread');
|
||||||
|
|
||||||
|
# Redirect for this old path to the new one
|
||||||
|
$thread->any([qw{GET POST}], '/post', sub ($c) {
|
||||||
|
$c->redirect_to('post_thread')
|
||||||
|
});
|
||||||
|
|
||||||
$human_thread->any([qw{GET POST}], '/post')
|
$human_thread->any([qw{GET POST}], '/post')
|
||||||
->to('thread#create')
|
->to('thread#create')
|
||||||
->name('post_thread');
|
->name('post_thread');
|
||||||
|
|
10
t/redirect_old_path.t
Normal file
10
t/redirect_old_path.t
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
use Mojo::Base -strict;
|
||||||
|
use Test::More;
|
||||||
|
use Test::Mojo;
|
||||||
|
|
||||||
|
my $t = Test::Mojo->new('PostText');
|
||||||
|
|
||||||
|
$t->get_ok('/thread/post')->status_is(302)
|
||||||
|
->header_like(Location => qr{human/thread/post});
|
||||||
|
|
||||||
|
done_testing;
|
Loading…
Reference in a new issue