X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FCatty.pm;h=83e6745d1f6896b9f17e98ff1cfa53674bdf2667;hb=affa35d5063fbeb1ca9ccc5bff2372b583c8575f;hp=34797013b7818d618db0ce1557e74efd869ac5e6;hpb=46377765ddd1edf4e7e17d1cee709786884740b3;p=catagits%2FTest-WWW-Mechanize-Catalyst.git diff --git a/t/lib/Catty.pm b/t/lib/Catty.pm index 3479701..83e6745 100644 --- a/t/lib/Catty.pm +++ b/t/lib/Catty.pm @@ -1,6 +1,7 @@ package Catty; use strict; +use warnings; #use Catalyst; use Catalyst; @@ -76,6 +77,13 @@ sub check_auth_basic : Global { } } +sub redirect_with_500 : Global { + my ( $self, $c ) = @_; + $DB::single = 1; + $c->res->redirect( $c->uri_for("/bonjour")); + die "erk!"; +} + sub die : Global { my ( $self, $context ) = @_; my $html = html( "Die", "This is the die page" ); @@ -84,6 +92,23 @@ sub die : Global { die "erk!"; } +sub name : Global { + my ($self, $c) = @_; + + my $html = html( $c->config->{name}, "This is the die page" ); + $c->response->content_type("text/html"); + $c->response->output($html); +} + +sub host : Global { + my ($self, $c) = @_; + + my $host = $c->req->header('Host') || ""; + my $html = html( $c->config->{name}, "Host: $host" ); + $c->response->content_type("text/html"); + $c->response->output($html); +} + sub html { my ( $title, $body ) = @_; return qq{ @@ -110,5 +135,14 @@ sub gzipped : Global { $c->response->headers->push_header( 'Vary', 'Accept-Encoding' ); } +sub user_agent : Global { + my ( $self, $c ) = @_; + + my $html = html($c->req->user_agent, $c->req->user_agent); + $c->response->content_type("text/html; charset=utf-8"); + $c->response->output( $html ); + +} + 1;