Item969: When rest method returns undef, headers are still printed
When you call a resthandler and
return undef, this case is skipping "wirteComplepage" and is expecting you to write headers and content.
Actually this is not happening, as in Engine::run the headers are printed anyway ( i mean the headers of Foswiki as if return 1 would have been used )
Iam actually not sure, this is supposed to be that way ( then return undef is completely senseless ) or this was introduced with FSA or i am simply not getting the right idea.
--
EugenMayer - 03 Feb 2009
This is working instead:
sub _restfunction {
my $session = shift;
$session->{response}->header( -status => "500 Test" );
$session->{response}->header( -"X-Testing" => "123" );
return "Hello World";
}
--
OliverKrueger - 03 Feb 2009
From todays irc discussion I learned, that the current behaviour is not wanted. I guess it was introduced with and is related to FSA. Setting this Item so Confirmed.
--
OliverKrueger - 04 Feb 2009
I think this problem was caused by the use of
Foswiki::Response::header to implement the
extra headers. I replaced that calls by
Foswiki::Response::pushHeader and I hope that the only headers returned by restHandler are those two plus the ones the handler defines.
Please check and comment/close this task
--
GilmarSantosJr - 04 Feb 2009
Well it seems to work now, but maybe Crawford has other issues. I set him on
WaitingFor to have his feedback or close this item. Thank you Gildmar
--
EugenMayer - 04 Feb 2009
I don't know which calls you replaced, but I'm a bit concerned that the author of a rest handler may not be able to tell from the documentation what function to call;
header or
pushHeader. See
http://trunk.foswiki.org/System/PerlDoc?module=Foswiki::Response to see what I mean. This needs to be fixed, IMHO.
--
CrawfordCurrie - 05 Feb 2009
I'll improve the documentation
--
GilmarSantosJr - 07 Feb 2009