[Dancer-users] params for post route not working

GJ gj at freeshell.org
Thu Mar 1 07:30:48 CET 2012


On Tue, Feb 21, 2012 at 09:55:34AM +0000, David Precious wrote:
> On Mon, 20 Feb 2012 18:33:11 +0000
> GJ <gj at freeshell.org> wrote:
> > On Mon, Feb 20, 2012 at 10:54:04AM +0000, David Precious wrote:
> > > On Sun, 19 Feb 2012 23:20:48 +0000
> > > GJ <gj at freeshell.org> wrote:
> > > > The above example is from the documentation, the result is the
> > > > `else' redirection. I tried my own code also.  params->user is
> > > > empty, in fact if I dump all `params' its empty.  
> > > 
> > > Interesting.  Can you dump the request object returned by the
> > > 'request' keyword so we can see what Dancer got?
> > 
> > 
> > $VAR1 = bless( {
> >                  '_read_position' => 0,
> >                  'content_length' => '27',
> >                  'connection' => 'keep-alive',
> >                  'headers' => bless( {
> >                                        'user-agent' => 'Mozilla/5.0
> > (Ubuntu; X11; Linux i686; rv:9.0.1) Gecko/20100101 Firefox/9.0.1',
> > 'connection' => 'keep-alive', 'accept' =>
> > 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
> > 'accept-language' => 'en-us,en;q=0.5', 'cookie' =>
> > 'session=5aa3a19de3fdd444d66a0ff1a799cc721a0d72a0; user_name=admin;
> > dancer.session=empty', 'accept-encoding' => 'gzip, deflate',
> > 'content-length' => '27', 'host' => 'localhost',
> >                                        'accept-charset' =>
> > 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'content-type' =>
> > 'application/x-www-form-urlencoded', 'referer' =>
> > 'http://localhost/login' }, 'HTTP::Headers' ),
> >                  '_http_body' => bless( {
> >                                           'content_length' => '27',
> >                                           'tmpdir' => '/tmp',
> >                                           'buffer' => '',
> >                                           'state' => 'buffering',
> >                                           'chunk_buffer' => '',
> >                                           'body' => undef,
> >                                           'content_type' =>
> > 'application/x-www-form-urlencoded', 'length' => 0,
> >                                           'chunked' => '',
> >                                           'upload' => {},
> >                                           'param_order' => [],
> >                                           'param' => {},
> >                                           'cleanup' => 1
> >                                         }, 'HTTP::Body::UrlEncoded' ),
> >                  '_route_pattern' => '/login',
> >                  'accept_encoding' => 'gzip, deflate',
> >                  '_route_params' => {},
> >                  'is_forward' => 0,
> >                  'uploads' => {},
> >                  '_body_params' => $VAR1->{'_http_body'}{'param'},
> >                  'body' => '',
> >                  'accept_charset' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
> >                  'method' => 'POST',
> >                  'id' => 1,
> <snipped rest>
> 
> Hmm.  It looks like the HTTP body contains content, but presumably
> hasn't been parsed yet.
> 
> Are you able to test against Perlover's pull request:
> 
> https://github.com/sukria/Dancer/pull/702 
> 
> I'd be interested to know if that helps or not.  From the dump above,
> it looks like the HTTP headers have been parsed already, so I'm not
> convinced it should make any difference.

So, I finally got around to this: I can report that Perlover's version fixes the issue with POSTed params.  

Thanks,
GJ


More information about the Dancer-users mailing list