Catalyst-Runtime

 view release on metacpan or  search on metacpan

t/aggregate/live_component_controller_action_local.t  view on Meta::CPAN


    {
        ok(
            my $response =
              request('http://localhost/action/local/four/five/six'),
            'Request'
        );
        ok( $response->is_success, 'Response Successful 2xx' );
        is( $response->content_type, 'text/plain', 'Response Content-Type' );
        is( $response->header('X-Catalyst-Action'),
            'action/local/four/five/six', 'Test Action' );
        is(
            $response->header('X-Test-Class'),
            'TestApp::Controller::Action::Local',
            'Test Class'
        );
        like(
            $response->content,
            qr/^bless\( .* 'Catalyst::Request' \)$/s,
            'Content is a serialized Catalyst::Request'
        );
    }

    SKIP:
    {
        if ( $ENV{CATALYST_SERVER} ) {
            skip "tests for %2F on remote server", 6;
        }

        ok(
            my $response =
              request('http://localhost/action/local/one/foo%2Fbar'),
            'Request'
        );
        ok( $response->is_success, 'Response Successful 2xx' );
        is( $response->content_type, 'text/plain', 'Response Content-Type' );
        is( $response->header('X-Catalyst-Action'),
            'action/local/one', 'Test Action' );
        is(
            $response->header('X-Test-Class'),
            'TestApp::Controller::Action::Local',
            'Test Class'
        );
        my $content = $response->content;
        {
            local $@;
            my $request = eval $content;
            if ($@) {
                fail("Content cannot be unserialized: $@ $content");
            }
            else {
                is_deeply $request->arguments, ['foo/bar'], "Parameters don't split on %2F";
            }
        }
    }

    {
        ok( my $content = get('http://locahost/action/local/five/foo%2Fbar%3B'),
            'request with URI-encoded arg');
        # this is the CURRENT behavior
        like( $content, qr{'foo/bar;'}, 'args for Local actions URI-decoded' );
    }
}



( run in 1.127 second using v1.01-cache-2.11-cpan-e1769b4cff6 )