make this work with cat 5.90080+
[catagits/Test-WWW-Mechanize-Catalyst.git] / t / lib / ExternalCatty / Controller / Root.pm
index 882b81d..83696fe 100644 (file)
@@ -10,6 +10,10 @@ sub default : Private {
     my ( $self, $c ) = @_;
     $c->response->content_type('text/html; charset=utf-8');
     $c->response->output( html( 'Root', 'Hello, test ☺!' ) );
+
+    # Newer Catalyst auto encodes UTF8, but this test case is borked and expects
+    # broken utf8 behavior.  We'll make a real UTF8 Test case separately.
+    $c->clear_encoding if $c->can('clear_encoding'); # Compat with upcoming Catalyst 5.90080
 }
 
 # redirect to a redirect
@@ -33,5 +37,14 @@ sub html {
 ];
 }
 
+sub host : Global {
+    my ($self, $c) = @_;
+
+    my $host = $c->req->header('Host') || "<undef>";
+    my $html = html( $c->config->{name}, "Host: $host" );
+    $c->response->content_type("text/html");
+    $c->response->output($html);
+}
+
 1;