[Catalyst] Conditional GET with Catalyst::Controller::REST
Gavin Carr
gavin at openfusion.com.au
Thu Sep 25 12:02:43 BST 2008
I'm seeing a weird problem trying to get conditional GETs
working under Catalyst::Controller::REST (0.66).
Short version is that everything works beautifully when
doing a HEAD, and my 304 is happily returned, but the same
code on a GET causes a 500, with nothing helpful logged.
Code snippet is:
sub index_GET {
my ($self, $c) = @_;
my $sset = $c->stash->{sset} or return;
my $ifmod_ts = $c->request->headers->if_modified_since;
my $sset_ts = $sset->modify_ts->epoch;
if ($ifmod_ts && $ifmod_ts == $sset_ts) {
$c->log->debug("not modified: ifmod_ts == sset_ts ($sset_ts)");
$c->response->status(304);
$c->log->debug('Status: ' . $c->response->status);
return 1;
}
# Rest of GET
# ...
}
In the logs I see the two debug lines, and then nothing else:
[debug] not modified: ifmod_ts == sset_ts (1222241031)
[debug] Status: 304
Any cluesticks as to what might be going on here? If I change the
status to almost anything else but 304 it all works fine. And it
doesn't seem to be the serialisation code either, as that explicitly
checks for 3xx status codes and exits.
Baffled. Anyone have conditional GETs working with C::C::REST?
Cheers,
Gavin
More information about the Catalyst
mailing list