[dancer-users] Accepting JSON in a POST request

Andrew Beverley andy at andybev.com
Mon Aug 24 09:55:31 BST 2015


On Mon, 2015-08-24 at 11:31 +0300, Gabor Szabo wrote:
> When I use Angular to send a POST request to the Dancer back-end, by
> default it send
> 
> 'CONTENT_TYPE' => 'application/json;charset=UTF-8',
> 
> and the data looks like this:
> 
> 'body' => '{"foo":23,"bar":19}',
> 
> and Dancer2 does not parse this.

I think a serializer should do what you want, but you need to explicitly enable
one:

https://metacpan.org/pod/Dancer2::Manual#Serializers1

Andy




More information about the dancer-users mailing list