<div dir="ltr">I am debugging a dancer2 ajax application which receives a POST request as follows<div><br></div><div><div>wget --post-data '{"item":{"filename":"/prj/dyumnin/<a href="http://designw.in/web/WS/log/Build_1/13RTL">designw.in/web/WS/log/Build_1/13RTL</a> Compile Check.log"}}' --header=Content-Type:application/json  <a href="http://localhost:5000/api/prjEdit/getFile.json">http://localhost:5000/api/prjEdit/getFile.json</a></div><div><br><b>My route definition is </b></div><div><b><br></b><div>package api;</div><div>use Data::Dumper;</div><div>use Dancer2 appname=>'web';</div><div>use Dancer2::Plugin::Database;</div><div>use spreadsheet;</div><div>use Data::GUID::Any 'guid_as_string';</div><div>use Dancer2::Plugin::REST;<br></div><div>use File::ReadBackwards;</div><div>prepare_serializer_for_format;<br><br></div>prefix '/api/prjEdit';<br><br><div>post '/getFileTail.:format'=>sub{</div><div>        my $data=body_parameters->get_all('item');</div><div>        debug Dumper $data;</div><div>        debug Dumper body_parameters;</div><div>         my %all_parameters = params;</div><div>        debug Dumper \%all_parameters;</div></div><div><br><br><b>What I see in the log is</b><br><br><div><br></div><div>[web:17548] core @2017-07-05 22:53:10> looking for post /api/prjEdit/getFileTail.json in /usr/local/share/perl/5.22.1/Dancer2/Core/App.pm l. 35</div><div>[web:17548] core @2017-07-05 22:53:10> Entering hook core.app.before_request in (eval 258) l. 1</div><div>[web:17548] debug @2017-07-05 22:53:10> <b>$VAR1 = undef;</b> in /prj/dyumnin/<a href="http://designw.in/web/bin/../lib/api.pm">designw.in/web/bin/../lib/api.pm</a> l. 211</div><div>[web:17548] debug @2017-07-05 22:53:10><b> $VAR1 = bless( {}, 'Hash::MultiValue' ); i</b>n /prj/dyumnin/<a href="http://designw.in/web/bin/../lib/api.pm">designw.in/web/bin/../lib/api.pm</a> l. 212</div><div>[web:17548] debug @2017-07-05 22:53:10><b> $VAR1 = {</b></div><div><b>          'format' => 'json'</b></div><div><b>        }; </b>in /prj/dyumnin/<a href="http://designw.in/web/bin/../lib/api.pm">designw.in/web/bin/../lib/api.pm</a> l. 214</div><div><br></div></div><div><br>Similar requests for other routes work.I am unable to understand why the body parameter is getting lost for this route. and Have not Idea where to begin my search. <br>To make matters worst when coupled with the Angular2 front end. for the same request sometimes the body parameters are passed to this route and sometimes they are not.<br><br>Any Hints on how to debug this scenario is welcome.<br><br>Regards<br>Vijay</div>-- <br><div class="gmail_signature"><a href="https://www.facebook.com/vijayvithal.jahagirdar" target="_blank">https://www.facebook.com/vijayvithal.jahagirdar</a><br><a href="https://twitter.com/jahagirdar_vs" target="_blank">https://twitter.com/jahagirdar_vs</a><br><a href="http://democracies-janitor.blogspot.in/" target="_blank">http://democracies-janitor.blogspot.in/</a><br></div>
</div></div>