From: Kevin L. Kane Date: Thu, 29 Oct 2015 18:32:03 +0000 (-0400) Subject: making SerializeBase respect Vary: header if it has already been set X-Git-Tag: v1.20~2^2^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b00b32deee48ef2e6e2999bde4c20e53b9e991da;hp=19cd07ecf000cd9fe5652c1a171e1a942902d20c;p=catagits%2FCatalyst-Action-REST.git making SerializeBase respect Vary: header if it has already been set --- diff --git a/lib/Catalyst/Action/SerializeBase.pm b/lib/Catalyst/Action/SerializeBase.pm index 9f7a1ac..b901f61 100644 --- a/lib/Catalyst/Action/SerializeBase.pm +++ b/lib/Catalyst/Action/SerializeBase.pm @@ -118,10 +118,12 @@ sub _load_content_plugins { } if ($search_path eq "Catalyst::Action::Serialize") { - if ($content_type) { - $c->response->header( 'Vary' => 'Content-Type' ); - } elsif ($c->request->accept_only) { - $c->response->header( 'Vary' => 'Accept' ); + unless( $c->response->header( 'Vary' ) ) { + if ($content_type) { + $c->response->header( 'Vary' => 'Content-Type' ); + } elsif ($c->request->accept_only) { + $c->response->header( 'Vary' => 'Accept' ); + } } $c->response->content_type($content_type); }