Created
September 3, 2013 03:26
-
-
Save ytnobody/6419435 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
use strict; | |
use warnings; | |
use Test::More; | |
use Plack::Builder; | |
use Plack::Test; | |
use HTTP::Request::Common; | |
my $app = sub { [200,[],['Hello, World']] }; | |
my $wrapped = builder { | |
enable 'SimpleContentFilter', filter => sub { s/Hello/Welcome/g; }; | |
$app; | |
}; | |
test_psgi $wrapped, sub { | |
my $cb = shift; | |
my $res = $cb->(GET '/'); | |
ok $res->is_success; | |
is $res->content, 'Welcome, World'; | |
}; | |
done_testing; |
SimpleContentFilter checks that Content-Type is 'text/*'.
When not matched, content will not be filtering.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got failure in this test...