3 use Catalyst qw[-Engine=Test];
5 TestApp->action( '!default' => \&default );
6 TestApp->action( 'index/a/b' => \&default );
10 $c->res->headers->header( 'X-Arguments' => $c->req->arguments );
11 $c->res->headers->header( 'X-Base' => $c->req->base );
12 $c->res->headers->header( 'X-Path' => $c->req->path );
13 $c->res->headers->content_type('text/plain');
14 $c->res->output('ok');
19 use Test::More tests => 9;
20 use Catalyst::Test 'TestApp';
25 $ENV{SCRIPT_NAME} = '/nph-catalyst.cgi';
26 $ENV{PATH_INFO} = '/index';
28 my $response = request('/nph-catalyst.cgi/index');
30 ok( $response->headers->header('X-Base') eq 'http://localhost/nph-catalyst.cgi' );
31 ok( $response->headers->header('X-Arguments') eq 'index' );
32 ok( $response->headers->header('X-Path') eq 'index' );
38 my $response = request('/index?a=a&b=b');
40 ok( $response->headers->header('X-Base') eq 'http://localhost/' );
41 ok( $response->headers->header('X-Arguments') eq 'index' );
42 ok( $response->headers->header('X-Path') eq 'index' );
48 my $response = request('http://localhost:8080/index/a/b/c');
50 ok( $response->headers->header('X-Base') eq 'http://localhost:8080/' );
51 ok( $response->headers->header('X-Arguments') eq 'c' );
52 ok( $response->headers->header('X-Path') eq 'index/a/b/c' );