[dancer-users] Accepting JSON in a POST request
Andrew Beverley
andy at andybev.com
Mon Aug 24 10:37:30 BST 2015
On Mon, 2015-08-24 at 12:10 +0300, Gabor Szabo wrote:
> I have just tried to set
>
> set serializer => 'JSON';
>
> that caused another issue. Now when I return the main page which is plain
> HTML, I get an error
>
> Failed to serialize the request: hash- or arrayref expected (not a simple
> scalar, use allow_nonref to allow this)
Ah yes, the auto-serializer's behaviour used to be that it would auto-detect and
act accordingly. That changed in a recent version of Dancer2, full details here:
http://advent.perldancer.org/2014/11
In short, you need a separate app, one with a serializer and one without.
> Reading the docs you linked to I thought it should just send out the plain
> HTML page as it is a plain scalar.
Looks like the docs need updating...
Andy
More information about the dancer-users
mailing list