1use strict;
2use warnings;
3use Test::Base;
4
5plan tests => 2 * blocks;
6
7use HTTP::Engine;
8use HTTP::Engine::Middleware;
9use HTTP::Request::Common;
10
11filters { post_params => [qw/eval/], };
12
13run {
14    my $block = shift;
15
16    my $mw = HTTP::Engine::Middleware->new;
17    $mw->install( 'HTTP::Engine::Middleware::MethodOverride', );
18    my $request = HTTP::Request::Common::POST( $block->uri, $block->post_params );
19    my $do_test = sub {
20        my $req = shift;
21        is $req->method, 'DELETE';
22        HTTP::Engine::Response->new( body => 'OK' );
23    };
24
25    my $response = HTTP::Engine->new(
26        interface => {
27            module          => 'Test',
28            request_handler => $mw->handler($do_test),
29        },
30    )->run($request);
31
32    is $response->content, 'OK';
33};
34
35__END__
36
37=== _method
38--- uri: http://localhost/
39--- post_params : [ '_method' => 'DELETE' ]
40
41
42