How to test for a redirect in Mojolicious?

I want to test a page with a form which, when submitted, will redirect to the resulting page for the submitted item.

My Mojolicious controller contains:

sub submit_new {
    my $self = shift;

    my $new = $self->db->resultset('Item')->new( {
        title       => $self->param('title'),
        description => $self->param('description'),
    } );

    # show the newly submitted item
    my $id = $new->id;

The test script for this controller contains:

use Test::More;
use Test::Mojo;

my $t = Test::Mojo->new('MyApp');

my $tx = $t->ua->build_form_tx('/items/new/submit' => $data);
$t->tx( $t->ua->start($tx) )

My issue is that it stops with the 302 status. How do I proceed with the redirect so I can verify the resulting item page?


Set the matching setting from Mojo::UserAgent:


Also, you don't need to build the form post manually:

$t->post_form_ok('/items/new/submit' => $data)->status_is(...);


Need Your Help

C Pointer Location, Decimal and Hexadecimal

c pointers hex decimal

I am trying to learn how to display the pointer value in decimal and hexadecimal. below you can see me create a value and try to use a pointer to print out the value and the values location.

Internal 500 error ever time post or get Ajax

php javascript ajax post get

Every time I try to post or use get from my file index.php which calls Ajax_mysql.php through the Ajax function POST or GET I keep getting a Internal 500 error. The server isnt giving any other error

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.