#title Status 400 from Dancer's before hook #author Stefan Hornburg (Racke) #topics blog; Dancer #date 2012-10-09 #pubdate 2012-10-09T10:57:44+02:00 #lang en Setting the HTTP status in Dancer's before hook with the status keyword doesn't work with the exception of 301 and 302 (redirects). To solve this problem, you can define first a special route for setting the HTTP status: get '/bad_request' => sub { status 400; return 'Bad request.'; } And advise Dancer to run this route from the before hook on a certain condition: hook before => sub { if (! param('customer_id')) { request->path_info('/bad_request'); } }