[dancer-users] Before Hook hit multiple times.

Alexis Sukrieh sukria at sukria.net
Wed Jan 2 16:16:32 GMT 2013


Hello,

First of all, how are you doing your hits? If you use a browser, like
Firefox, chances are that it will request favicon.ico at each requests,
hence you'll see at least 2 hits.

Also, it's possible that a HEAD request is done before the real GET
request, depends on the browser.

For testing purposes, I strongly sugesst using curl to send exactly one
request:

  $ curl -i http://0:3000/some_route

Cheers,


2013/1/2 Rick Bragg <rbragg at gmnet.net>

> Hi,
>
> I put a simple test in my before hook:
>
> hook 'before' => sub {
>         debug "Before Hook";
> };
>
> and a couple of quick routes:
>
> #Home Page
> get '/' => sub { template 'index'; };
>
> #About Us page
> get '/about-us' => sub { template 'about-us'; };
>
> (I am also using Auth::Extensible)
>
> Whenever I hit the home page, I get 3 debug messages in a row in the log.
> Whenever I hit the about-up page, I get 2 debug messages in a row in the
> log.
>
> I thought that any kind of page hook would only be called once.  Does
> anybody know
> why the before hook would ever be called more than once?
>
> Rick
>
>
>
>
>
>
>
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20130102/78fe3805/attachment.htm>


More information about the dancer-users mailing list