-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BACKWARD INCOMPATILBE: '/' mapping now really means it only matches
with the root /. Current catch-all behavior is not what you want in 90% of the use case. If you really want to write a catch-all handler you can map '/.*'
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
use Plack::Test; | |||
use Test::More; | |||
use HTTP::Request::Common; | |||
use Tatsumaki::Application; | |||
|
|||
package HelloApp; | |||
use base qw(Tatsumaki::Handler); | |||
|
|||
sub get { | |||
my $self = shift; | |||
$self->write("Hello World"); | |||
} | |||
|
|||
package main; | |||
my $app = Tatsumaki::Application->new([ '/' => 'HelloApp' ]); | |||
|
|||
test_psgi $app, sub { | |||
my $cb = shift; | |||
my $res = $cb->(GET "http://localhost/"); | |||
ok $res->is_success; | |||
is $res->code, 200; | |||
is $res->content, 'Hello World'; | |||
|
|||
$res = $cb->(GET "http://localhost/foo"); | |||
is $res->code, 404; | |||
|
|||
$res = $cb->(POST "http://localhost/"); | |||
is $res->code, 405; | |||
}; | |||
|
|||
done_testing; |