1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#!/usr/bin/perl
use strict;
use warnings;
use lib 't/010-resources/';
use Test::More;
use Test::FailWarnings;
use Plack::Request;
use Plack::Response;
use Web::Machine::FSM;
use Web::Machine::Util qw[ inflate_headers ];
{
package NoEtag;
use base 'Web::Machine::Resource';
sub allowed_methods { [qw[ GET ]] }
sub content_types_provided {
[
{
'text/plain' => sub { return 'x' }
}
];
}
}
my $request = inflate_headers(
Plack::Request->new(
{
REQUEST_METHOD => 'GET',
CONTENT_TYPE => 'text/plain',
HTTP_IF_NONE_MATCH => 'foobar',
}
)
);
my $r = NoEtag->new(
request => $request,
response => Plack::Response->new
);
my $fsm = Web::Machine::FSM->new;
my $response = $fsm->run($r);
ok( $response, 'got a response' );
done_testing;
|