about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepoBase.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-03-03 00:55:07 +0000
committerEric Wong <e@80x24.org>2017-03-03 00:55:07 +0000
commitb9b12ac92230cc6807623293b93cc22e5eb33684 (patch)
treee05c029ebd6a16bbd9dd5045dcff7d2701794235 /lib/PublicInbox/RepoBase.pm
parent16b1fbe36cc39a351ef9810b9018d36df833a941 (diff)
downloadpublic-inbox-b9b12ac92230cc6807623293b93cc22e5eb33684.tar.gz
For everything with relevant content, we'll try to set
UTF-8 charset and reduce duplication when generating
response headers.
Diffstat (limited to 'lib/PublicInbox/RepoBase.pm')
-rw-r--r--lib/PublicInbox/RepoBase.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/RepoBase.pm b/lib/PublicInbox/RepoBase.pm
index 9876cf2a..e600b1df 100644
--- a/lib/PublicInbox/RepoBase.pm
+++ b/lib/PublicInbox/RepoBase.pm
@@ -105,10 +105,17 @@ sub r {
                 # mainly for curl (no-'-L') users:
                 $body = "Redirecting to $redir\n";
         } else {
-                push @h, qw(Content-Type text/plain);
+                push @h, 'Content-Type', 'text/plain; charset=UTF-8';
         }
 
         [ $status, \@h, [ $body ] ]
 }
 
+sub rt {
+        my ($self, $status, $t) = @_;
+        my $res = [ $status, [ 'Content-Type', "text/$t; charset=UTF-8" ] ];
+        $res->[2] = [ $_[3] ] if defined $_[3];
+        $res;
+}
+
 1;