[Dancer-users] dancer2's prototype is there, feedback needed

Assaf Gordon gordon at cshl.edu
Mon Oct 3 19:43:13 CEST 2011


Hi, 

another problem: POST request with parameters hangs.

Steps to reproduce:
====
## New dancer app
$ dancer -a d2test5post
$ cd d2test5post/

## Change the "GET" to a "POST":
$ sed -i '/^get/s/^get/post/' lib/d2test5post.pm
$ cat lib/d2test5post.pm
package d2test5post;
use Dancer ':syntax';

our $VERSION = '0.1';

post '/' => sub {
    template 'index';
};

true;

## run the application with Dancer 1:
$ ./bin/app.pl

##
## In a new terminal, run the following commands:
##

## Access the app with "GET" - this fails (as expected).
$ curl http://localhost:3000/
[ 404 response ]

## Access the app with "POST" (no parameters) - works OK
$ curl -X POST http://localhost:3000/
[ ... ]

## Access the app with "POST" (and parameters) - works OK
$ curl -X POST -d name=foobar http://localhost:3000/
[ ... ]


##
## Now test with Dancer 2
##

## change the 'config.yml' and the templates to use Dancer2's TT
$ sed -i '/^template:/s/".*"/"toolkit"/' config.yml 
$ sed -i 's/<%/[%/g' views/index.tt 
$ sed -i 's/%>/%]/g' views/index.tt 
$ sed -i 's/<%/[%/g' views/layouts/main.tt 
$ sed -i 's/%>/%]/g' views/layouts/main.tt 

## Run with Dancer2
$ perl -I ../sources/dancer2/lib ./bin/app.pl 


##
## In a new terminal, run the following commands
##

## Access the app with "GET" - this fails (as expected).
$ curl http://localhost:3000/
[ 404 response ]

## Access the app with "POST" (no parameters) - works OK
$ curl -X POST http://localhost:3000/
[ ... ]

## Access the app with "POST" (and parameters) - FAILS - the request hangs, BEFORE even reaching my 'post' handler code.
$ curl -X POST -d name=foobar http://localhost:3000/
[ XXXX - Stuck - XXXX ]

==================


regards, 
 -gordon


More information about the Dancer-users mailing list