Configuration patches to handle component based configuration in a sane way, as well...
[catagits/Catalyst-Action-Serialize-Data-Serializer.git] / lib / Catalyst / Action / Serialize / YAML / HTML.pm
index 93a95d3..0fce953 100644 (file)
@@ -18,7 +18,11 @@ sub execute {
     my $self = shift;
     my ( $controller, $c ) = @_;
 
-    my $stash_key = $controller->config->{'serialize'}->{'stash_key'} || 'rest';
+    my $stash_key = (
+            $controller->config->{'serialize'} ?
+                $controller->config->{'serialize'}->{'stash_key'} :
+                $controller->config->{'stash_key'} 
+        ) || 'rest';
     my $app = $c->config->{'name'} || '';
     my $output = "<html>";
     $output .= "<title>" . $app . "</title>";
@@ -28,7 +32,13 @@ sub execute {
     my $finder = URI::Find->new(
                               sub {
                                   my($uri, $orig_uri) = @_;
-                                  return qq|<a href="$uri">$orig_uri</a>|;
+                                  my $newuri;
+                                  if ($uri =~ /\?/) {
+                                      $newuri = $uri . "&content-type=text/html";
+                                  } else {
+                                      $newuri = $uri . "?content-type=text/html";
+                                  }
+                                  return qq|<a href="$newuri">$orig_uri</a>|;
                               });
     $finder->find(\$text);
     $output .= $text;