[Dancer-users] t/002_index_route.t fails on an unmodified application

Benjamin Nadland benjamin.nadland at freenet.de
Fri Feb 18 15:40:35 CET 2011


I get a weird failing test when I make a new and
unmodified dancer application.

t/002_index_route.t fails due to an unexpected "404 Not Found"

(15:19:03)[~/source/webstuff]$ dancer -v
Dancer 1.3011

(15:19:39)[~/source/webstuff]$ dancer -a testbug
+ testbug
+ testbug/bin
+ testbug/bin/app.pl
+ testbug/config.yml
+ testbug/environments
+ testbug/environments/development.yml
+ testbug/environments/production.yml
+ testbug/views
+ testbug/views/index.tt
+ testbug/views/layouts
+ testbug/views/layouts/main.tt
+ testbug/lib
  testbug/lib/
+ testbug/lib/testbug.pm
+ testbug/public
+ testbug/public/css
+ testbug/public/css/style.css
+ testbug/public/css/error.css
+ testbug/public/images
+ testbug/public/500.html
+ testbug/public/404.html
+ testbug/public/dispatch.fcgi
+ testbug/public/dispatch.cgi
+ testbug/public/javascripts
+ testbug/public/javascripts/jquery.js
+ testbug/Makefile.PL
+ testbug/t
+ testbug/t/002_index_route.t
+ testbug/t/001_base.t

(15:20:00)[~/source/webstuff]$ cd testbug
(15:20:07)[~/source/webstuff/testbug]$ perl -Ilib t/002_index_route.t 
1..2
ok 1 - a route handler is defined for /
not ok 2 - response status is 200 for /
#   Failed test 'response status is 200 for /'
#   at /home/bnadland/perl5/lib/perl5/Dancer/Test.pm line 108.
#          got: '404'
#     expected: '200'
# Looks like you failed 1 test of 2.

But if I test this by Hand, I get the expected "200 OK":

(15:20:21)[~/source/webstuff/testbug]$ perl bin/app.pl
[28164]  core @0.000079> loading Dancer::Handler::Standalone handler in /home/bnadland/perl5/lib/perl5/Dancer/Handler.pm l. 39
[28164]  core @0.002450> loading handler 'Dancer::Handler::Standalone' in /home/bnadland/perl5/lib/perl5/Dancer.pm l. 230
>> Dancer 1.3011 server 28164 listening on http://0.0.0.0:3000
== Entering the development dance floor ...
[28164]  core @0.000872> request: GET / from 127.0.0.1 in /home/bnadland/perl5/lib/perl5/Dancer/Handler.pm l. 49
[28164]  core @0.003825> [hit #1]trying to match `/' against /^\/$/ in /home/bnadland/perl5/lib/perl5/Dancer/Route.pm l. 74
[28164]  core @0.005695> [hit #1]  --> got 1 in /home/bnadland/perl5/lib/perl5/Dancer/Route.pm l. 81
[28164]  core @0.245683> [hit #1]response: 200 in /home/bnadland/perl5/lib/perl5/Dancer/Handler.pm l. 131

(15:20:41)[~]$ echo "GET / HTTP/1.0\r\n\r\n" | nc localhost 3000 | grep HTTP
HTTP/1.0 200 OK

Any ideas what happens here?

(I am a Perl/Dancer/Webdevelopment newbie and might be doing something stupid here.
If that is the case I would also be glad to know.)


More information about the Dancer-users mailing list