From 5b576b43fa056fc48f912ed586a56e79d3f32248 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Thu, 3 Apr 2014 12:24:20 -0400 Subject: [PATCH] Correcion en error de body en MULTIPART --- framework/src/Maveriks/WebApplication.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 8d645659f..edc86752e 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -3,6 +3,8 @@ namespace Maveriks; use Maveriks\Util; use ProcessMaker\Services; +use ProcessMaker\Services\Api; +use Luracast\Restler\RestException; class WebApplication { @@ -106,10 +108,19 @@ class WebApplication public function multipart($uri, $version = "1.0") { $stringInput = file_get_contents('php://input'); - if (is_null($stringInput)) { - return array(); //no body + if (empty($stringInput)) { + $rest = new \Maveriks\Extension\Restler(); + $rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, "Invalid Request, multipart without body.")); + exit(); + } else { + $input = json_decode($stringInput); + if (empty($input->calls)) { + $rest = new \Maveriks\Extension\Restler(); + $rest->setMessage(new RestException(Api::STAT_APP_EXCEPTION, "Invalid Request, multipart body without calls.")); + exit(); + } } - $input = json_decode($stringInput); + $baseUrl = (empty($input->base_url)) ? $uri : $input->base_url; foreach($input->calls as $value) {