Test fixes - how did this ever pass before?
[catagits/Test-WWW-Mechanize-Catalyst.git] / t / lib / ExternalCatty / Controller / Root.pm
CommitLineData
2140e65c 1package ExternalCatty::Controller::Root;
2use strict;
3use warnings;
4
5use base qw/ Catalyst::Controller /;
6
7__PACKAGE__->config( namespace => '' );
8
9sub default : Private {
10 my ( $self, $c ) = @_;
11 $c->response->content_type('text/html; charset=utf-8');
12 $c->response->output( html( 'Root', 'Hello, test ☺!' ) );
13}
14
15# redirect to a redirect
16sub hello: Global {
17 my ( $self, $context ) = @_;
18 my $where = $context->uri_for('/');
19 $context->response->redirect($where);
20 return;
21}
22
23sub html {
24 my ( $title, $body ) = @_;
25 return qq[
26<html>
27<head>
28 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
29 <title>$title</title>
30</head>
31<body>$body</body>
32</html>
33];
34}
35
4ab99758 36sub host : Global {
37 my ($self, $c) = @_;
38
39 my $host = $c->req->header('Host') || "<undef>";
40 my $html = html( $c->config->{name}, "Host: $host" );
41 $c->response->content_type("text/html");
42 $c->response->output($html);
43}
44
2140e65c 451;
46