From 78c9a1d64c917bcaa535888b88bf47d46b420118 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Tue, 4 Mar 2014 08:36:21 +1300 Subject: [PATCH] Trying to handle posts with no parameters better in the Dancer app --- lib/NCIP/Dancing.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/NCIP/Dancing.pm b/lib/NCIP/Dancing.pm index 11e8197..8b65bc8 100644 --- a/lib/NCIP/Dancing.pm +++ b/lib/NCIP/Dancing.pm @@ -5,11 +5,14 @@ our $VERSION = '0.1'; use NCIP; - -any ['get', 'post'] => '/' => sub { +any [ 'get', 'post' ] => '/' => sub { my $ncip = NCIP->new('t/config_sample'); - my $xml = param 'xml'; + my $xml = param 'xml'; + if ( request->is_post ) { + $xml = request->body; + } my $content = $ncip->process_request($xml); + warn $content; template 'main', { content => $content }; }; -- 2.11.0