Subject: | Custom response headers lost when using JSON serializer |
Date: | Tue, 25 May 2010 19:31:20 +0100 |
To: | bug-Dancer [...] rt.cpan.org |
From: | Richard Evans <richard_david_evans [...] yahoo.co.uk> |
Hello again
Dancer 1.1803
Possibly an issue using the JSON serializer with custom response headers, they appear to get lost - example:
package todo;
use Dancer ':syntax';
#set serializer => 'JSON';
our $VERSION = '0.1';
post '/' => sub {
header 'X-Test' => 'ok';
return { body => 'ok' };
};
true;
$ curl http://127.0.0.1:3000 -X POST -v -H "Content-Type: application/json" -d '{"description":"foo"}'
...
< HTTP/1.0 200 OK
< X-Test: ok
< Content-Type: text/html
< X-Powered-By: Perl Dancer 1.1803
<
...
With "set serializer => 'JSON';" uncommented, the "X-Test: ok" custom header is not output:
$ curl http://127.0.0.1:3000 -X POST -v -H "Content-Type: application/json" -d '{"description":"foo"}'
...
< HTTP/1.0 200 OK
< Content-Type: application/json
< X-Powered-By: Perl Dancer 1.1803
<
...
Best wishes
Richard