]> Sergey Matveev's repositories - public-inbox.git/commitdiff
feed: use application/atom+xml for Content-Type
authorEric Wong <e@80x24.org>
Thu, 3 Sep 2015 08:27:42 +0000 (08:27 +0000)
committerEric Wong <e@80x24.org>
Thu, 3 Sep 2015 08:27:42 +0000 (08:27 +0000)
This is the correct Content-Type for Atom feeds, especially
since we updated to use ".atom" as the suffix.

lib/PublicInbox/Feed.pm
t/cgi.t

index 2284f2399cdbafdffebf3a00691f91c0fcdbafeb..75fecf5b432cad06409b1a8efabfe9ece47db68f 100644 (file)
@@ -60,7 +60,7 @@ sub atom_header {
 
 sub emit_atom {
        my ($cb, $ctx) = @_;
-       my $fh = $cb->([ 200, ['Content-Type' => 'application/xml']]);
+       my $fh = $cb->([ 200, ['Content-Type' => 'application/atom+xml']]);
        my $max = $ctx->{max} || MAX_PER_PAGE;
        my $feed_opts = get_feedopts($ctx);
        my $x = atom_header($feed_opts);
@@ -97,7 +97,7 @@ sub emit_atom_thread {
        my ($cb, $ctx) = @_;
        my $res = $ctx->{srch}->get_thread($ctx->{mid});
        return _no_thread($cb) unless $res->{total};
-       my $fh = $cb->([200, ['Content-Type' => 'application/xml']]);
+       my $fh = $cb->([200, ['Content-Type' => 'application/atom+xml']]);
        my $feed_opts = get_feedopts($ctx);
 
        my $html_url = $feed_opts->{atomurl} = $ctx->{self_url};
diff --git a/t/cgi.t b/t/cgi.t
index b0af8ae179b2af2c8b9f6f5e00face8180ae6207..7f72eaa5df5e6842fa1f17ae453c68a2cf233bb3 100644 (file)
--- a/t/cgi.t
+++ b/t/cgi.t
@@ -206,7 +206,7 @@ EOF
                $path = "/test/blahblah%40example.com/t.atom";
                $res = cgi_run($path);
                like($res->{head}, qr/^Status: 200 /, "atom returned 200");
-               like($res->{head}, qr!^Content-Type: application/xml!m,
+               like($res->{head}, qr!^Content-Type: application/atom\+xml!m,
                        "search returned atom");
                my $p = XML::Feed->parse(\($res->{body}));
                is($p->format, "Atom", "parsed atom feed");