Bug in Dancer1 (devel branch) - no request->header inside routes
Hello, I found a bug as i think in Dancer1 -> devel branch Please take a look at Dancer::Deployment -> Running multiple apps with Plack::Builder my $app2 = sub { my $env = shift; local $ENV{DANCER_APPDIR} = '/Users/franck/tmp/app2'; # 'mount_at' is used to guarantee that the routes of the applications do # not intersect load_app "app2", mount_at => "/app2"; Dancer::App->set_running_app('app2'); setting appdir => '/Users/franck/tmp/app2'; Dancer::Config->load; my $request = Dancer::Request->new( env => $env ); ^^^^^^^^^^^^^^ Here $request->{headers} will be undef because Dancer::SharedData->headers will return undef (my variable $_headers will be undef) Dancer->dance($request); ^^^^^^^ Inside here in Dancer::Handler in the sub handle_request will be initialized $_headers of Dancer::SharedData but $request object will be keep {headers} as undef }; Thus in PSGI variant we will not get any headers through request->header('...') I can try to make patch for this Perlover
Sorry I have strange behavior but i think but i think this code is not root of problem My request->header from route code throws the exception as Can't call method "header" on an undefined value at /usr/local/share/perl5/Dancer/Request.pm line 92. in /usr/local/share/perl5/Dancer/Handler.pm l. 101 But i cannot make a correct patch for it yet The github's branch is 'devel' I am finding a problem... 2011/11/23 Perlover <perlover@perlover.com>:
Hello,
I found a bug as i think in Dancer1 -> devel branch
Please take a look at Dancer::Deployment -> Running multiple apps with Plack::Builder
my $app2 = sub { my $env = shift; local $ENV{DANCER_APPDIR} = '/Users/franck/tmp/app2'; # 'mount_at' is used to guarantee that the routes of the applications do # not intersect load_app "app2", mount_at => "/app2"; Dancer::App->set_running_app('app2'); setting appdir => '/Users/franck/tmp/app2'; Dancer::Config->load; my $request = Dancer::Request->new( env => $env ); ^^^^^^^^^^^^^^ Here $request->{headers} will be undef because Dancer::SharedData->headers will return undef (my variable $_headers will be undef) Dancer->dance($request); ^^^^^^^ Inside here in Dancer::Handler in the sub handle_request will be initialized $_headers of Dancer::SharedData but $request object will be keep {headers} as undef };
Thus in PSGI variant we will not get any headers through request->header('...')
I can try to make patch for this
Perlover
Hello, I fixed it :) https://github.com/sukria/Dancer/pull/702 Please approve & merge request Perlover 2011/11/23 Perlover <perlover@perlover.com>:
Hello,
I found a bug as i think in Dancer1 -> devel branch
Please take a look at Dancer::Deployment -> Running multiple apps with Plack::Builder
my $app2 = sub { my $env = shift; local $ENV{DANCER_APPDIR} = '/Users/franck/tmp/app2'; # 'mount_at' is used to guarantee that the routes of the applications do # not intersect load_app "app2", mount_at => "/app2"; Dancer::App->set_running_app('app2'); setting appdir => '/Users/franck/tmp/app2'; Dancer::Config->load; my $request = Dancer::Request->new( env => $env ); ^^^^^^^^^^^^^^ Here $request->{headers} will be undef because Dancer::SharedData->headers will return undef (my variable $_headers will be undef) Dancer->dance($request); ^^^^^^^ Inside here in Dancer::Handler in the sub handle_request will be initialized $_headers of Dancer::SharedData but $request object will be keep {headers} as undef };
Thus in PSGI variant we will not get any headers through request->header('...')
I can try to make patch for this
Perlover
participants (1)
-
Perlover