Skip Menu |

This queue is for tickets about the Catalyst-Action-REST CPAN distribution.

Report information
The Basics
Id: 108095
Status: new
Priority: 0/
Queue: Catalyst-Action-REST

People
Owner: Nobody in particular
Requestors: KKANE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Vary Header Getting Clobbered by Catalyst::Action::SerializeBase
Hi, I am trying to set a Vary: Origin header for an application that is utilizing Catalyst::Action::REST. However when I set the header via $c->response->header( 'Vary' => 'Origin' );, it gets overwritten by a block of code within Catalyst::Action::SerializeBase. This is problematic for me as I need the Vary: Origin header in order for my application to operate correctly. I attached a patch that only sets the Vary header within Catalyst::Action::SerializeBase if the Vary header is not already set thus allowing you to specify a specific Vary header if you need to. Thanks, Kevin
Subject: catalyst_action_rest.patch
diff --git a/lib/Catalyst/Action/SerializeBase.pm b/lib/Catalyst/Action/SerializeBase.pm index d9b1d31..e5ffc80 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); }